snippet substitution
hamishinglis
Posts: 2
I was setting up some snippets and after clicking around on the site saw that if you enter $cursor$ that is where the cursor is left after the snippet is activated. But what i really wanted was the Date!... so i took a guess and put in $DATE$ and it worked... Is there a complete list of substitutions for snippets anywhere? why isn't this stuff with the edit snippet help page?
Also i noticed that snippets do not work if you are inside a /* */ block ? which is sad since in means you can't have a snippet for update comments like your name, the date etc.. so it always makes a consistent comment block. Is there a reason for this?
Also i noticed that snippets do not work if you are inside a /* */ block ? which is sad since in means you can't have a snippet for update comments like your name, the date etc.. so it always makes a consistent comment block. Is there a reason for this?
Comments
I believe the reasoning for the snippets not working in the comment block is that the parser ignores everything between the comments.
In regards to the list of additional snippets, here are some more:
code = code.Replace("$DATE$", DateTime.Now.ToShortDateString());
code = code.Replace("$TIME$", DateTime.Now.ToShortTimeString());
code = code.Replace("$USER$", Environment.UserName);
code = code.Replace("$MACHINE$", Environment.MachineName);
Best Regards,
Steve
Steve Tanori
Product Support
Red Gate Software Ltd.
866-997-0378