Snippet Template Fields
Enhance snippets to support arbitrary fields like Visual Studio or SSMS 2012.
So say I had the following snippet "dups" defined
SELECT *
FROM $tablename$
WHERE $columnname$ IN
(
SELECT $columnname$
FROM $tablename$
GROUP BY $columnname$
HAVING COUNT(*) > 1
);
I would type dups{tab}mytable{tab}mycolumn{enter}
This is included in SQL Prompt 7 which you can download from http://www.red-gate.com/products/sql-development/sql-prompt/
-
Chris Rickard commented
Just tried it out. Beautiful and very intuitive!
-
AdminAaron Law (Admin, Redgate) commented
Hi Jordan,
We'll mark this UserVoice request as closed (which should notify you and return your votes) when the release is official.
-
Jordan Morris commented
How can I be notified when this release is official, please?
-
Chris Rickard commented
Invoking a dialog and filling out a grid is waaaaay too cumbersome for what I want to get out of it. I would also loose the benefit of all SQL Prompt intellisense when filling out values.
To put it another way, would you be happy if Visual Studio/CodeRush/ReSharper changed their snippet/templating systems to this model? :)
SSMS2012 actually has my ideal behavior except that there is no way to invoke the snippet engine via TAB key they way SQL Prompt/VS+c# does.
-
Jordan Morris commented
It would be very helpful if multiple $CURSOR$ positons could be added to a snippet, such that when you are happy with your entry in the first cursor position, you can press tab to automatically go to the next cursor position in the snippet, until they are all filled in.
This will be much better than combining snippets with microsoft templates, because those do not support intellisense.
-
One thing you can do to achieve this is to use snippets with template parameters as described in this blog post: http://www.simple-talk.com/blogs/2012/04/20/using-a-sql-prompt-snippet-with-template-parameters/ Will this work for you?