I've created the following code snippet:
<?xml version="1.0" encoding="utf-8"?><CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"><CodeSnippet Format="1.0.0"><Header><Title>Blah</Title><Shortcut>bb</Shortcut></Header><Snippet><Code Language="VB">'Comment1</Code></Snippet></CodeSnippet></CodeSnippets>
Let's say I have the following VB line of code ("Dim s As String") and on the preceeding line, I type "bb" (my snippet shortcut) and then Tab:
bb Dim s As String
The result is "bb" is replaced with "'Comment1" and the cursor is resting after the '1'.
'Comment1 Dim s As String
However, as soon as I make the snippet span multiple lines:
<?xml version="1.0" encoding="utf-8"?><CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"><CodeSnippet Format="1.0.0"><Header><Title>Blah</Title><Shortcut>bb</Shortcut></Header><Snippet><Code Language="VB">'Comment1
'Comment2</Code></Snippet></CodeSnippet></CodeSnippets>
And do the same thing, type "bb" + Tab on the line above:
bb Dim s As String
The result I get is that The two comment lines are inserted on separate lines as I'd expect, the cursor is now resting after the '2', but an extra blank line has been inserted after the snippet:
'Comment1 'Comment2 Dim s As String
I have to manually remove that blank line every time I use the snippet, which is really frustrating as as it flies in the face of the whole reason I'm using a snippet to begin with (which is to save me having to press extra keys).
I've tried wrapping Code in a CDATA, but it doesn't help. It seems there's no way I can work around this. When it's a multi-line code snippet it always puts in that annoying extra line.