snippet substitution

hamishinglishamishinglis Posts: 2
edited July 5, 2012 5:50PM in SQL Prompt Previous Versions
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?


  • Options
    Hello hamishinglis,

    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 Tanori
    Product Support
    Red Gate Software Ltd.
Sign In or Register to comment.