Code Snippets: Using SurroundsWith

N

Nathan Sokalski

I am learning how to use and write Code Snippets. I have successfully
learned how to write and use Code Snippets with
<SnippetType>Expansion</SnippetType> with no problem. However, I am having
trouble writing/using Code Snippets with
<SnippetType>SurroundsWith</SnippetType>. From my understanding, this is a
Code Snippet that uses the selected text in the Code Snippet. Here are my
two main questions:

1. How do you use the ShortCut? If you start typing after selecting text,
the text becomes unselected, therefore causing nothing to be selected when
the Code Snippet is inserted.

2. In the *.snippet file, how do you reference the selected text? In Figure
11 on http://msdn2.microsoft.com/en-us/library/bb245788(VS.80).aspx the
Literal $selected$ is used for this, so I am assuming that is correct. Is it
(I cannot test it until my first question is answered)?

Any help would be appreciated. Thanks.
 
B

Bill McCarthy

Hi Nathan,

The snippet schema includes features that not all languages support. For
example, in C# you have SurroundsWith and replacements can call some
predefined C# macros, but not in VB. In VB, a snippet can include Imports
statements and References, but not in C#.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top