Wednesday, July 8, 2009

Visual Studio Region Snippet

I like to format my regions, so the region name is at the bottom of the region, that way I don't have to scroll all the way to the top to see the next region. I've been doing this by hand all the time, and figured it was about time for me to create a code snippet for it.

Using this telerick blog, I was able to see the folder that all the snippets are stored ("<Visual Studio installation directory>\VC#\Snippets\1033\Visual C#") and then the rest was easy.



<?xml version="1.0" encoding="utf-8" ?>
CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<
CodeSnippet Format="1.0.0">
<
Header>
<
Title>region</Title>
<
Shortcut>region</Shortcut>
<
Description>Code snippet for region</Description>
<
Author>Daryl LaBar</Author>
<
SnippetTypes>
<
SnippetType>Expansion</SnippetType>
<
SnippetType>SurroundsWith</SnippetType>
</
SnippetTypes>
</
Header>
<
Snippet>
<
Declarations>
<
Literal>
<
ID>name</ID>
<
ToolTip>Region name</ToolTip>
<
Default>MyRegion</Default>
</
Literal>
</
Declarations>
<
Code Language="csharp"><![CDATA[#region $name$

$selected$$end$

#endregion // $name$
]]>
</
Code>
</
Snippet>
</
CodeSnippet>
CodeSnippets>


No comments: