Snippet in Visual Studio to create static method
June 27th 2007After using Textmate for a couple of weeks I’ve come to realise how incredibly powerful and beautiful it is! Creating text snippets is a breeze – and improves productivity no end!
To achieve the same affect in Visual Studio though is a right pain in the butt-ocks. All I wanted to do was create a very basic snippet to define a static method (because I was creating a bunch of them all at the same time) and had to get down and dirty with some XML.
Anyhoo – here’s my result:
<?xml version="1.0" encoding="utf-8"?> <codesnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> <codesnippet format="1.0.0"> <header> </header></codesnippet></codesnippets>
Then you just type pubs[tab] and it will create a declation like this:
public static void method(param_type param) { }
With the ability to tab between the different fields.
But oh man what a pain that was to do! (I love you textmate – xx)