I know this is a long time ago, and you probably found the answer, but I just wanted to add for the sake of those who may not know that this is possible in VS 2010:
- Choose the code you want to surround.
- Make
ctrl-k ctrl-s (or right-click and select Surround with... - There are many HTML snippets to choose from.
You can create your own SurroundsWith snippets if you do not find what you are looking for:
- Click
File , and then click New and select an XML file type. - From the
File menu, click Save . - In the
Save as field, select All Files (*.*) . - In the
File name field, enter a file name with the .snippet file name extension. - Click
Save .
Enter something like the following example in an XML file:
<CodeSnippet Format="1.1.0" xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> <Header> <Title>ul-div</Title> <Author>Microsoft Corporation</Author> <Shortcut>ul>li</Shortcut> <Description>Wrap in a ul and then an li</Description> <SnippetTypes> <SnippetType>Expansion</SnippetType> <SnippetType>SurroundsWith</SnippetType> </SnippetTypes> </Header> <Snippet> <Declarations> <Literal> <ID>selected</ID> <ToolTip>content</ToolTip> <Default>content</Default> </Literal> </Declarations> <Code Language="html"><![CDATA[<ul><li>$selected$</li></ul>$end$]]></Code> </Snippet> </CodeSnippet>
- Go to
Tools > Code Snippets Manager . - Click
Import and go to the fragment you just created. - Check
My HTML Snippets and click Finish and then OK .
After that, you will get your shiny new HTML snippet that you can wrap!
Bradley Mountford May 21 '10 at 2:20 a.m. 2010-05-21 02:20
source share