If you are a ReSharper user (I know many of you are) and you are NOT taking advantage of the LiveTemplates feature, you are really not maximizing your productivity.
Today I thought I would do a quick demo on how to create and use a LiveTemplate. Sit back, relax and learn how to make yourself more productive. For some info on LiveTemplates from JetBrains check this out.
Steps to creating your LiveTemplate
- Determine code that you create all the time
For me I am always typing out Assert.That( XYZ, Is.EqualTo( ABC ) ) in my tests, so lets turn this into a LiveTemplate
- Launch the LiveTemplate Explorer
Reshaper -> LiveTemplates
- Determine where you want to place your new template
I would suggested you put it under the "User Templates" section, but your call.
- Select where you want to put your template and click the new button
This should open up a new editor window, this is where the fun begins.
- Provide a Shortcut. This is what you will type to produce the code in the LiveTemplate. I would suggest you come up with a standard naming scheme to make life easier, but again your call.
- Provide a Description
- Copy and Paste in your code you want to use.
- Determine if you want any variables (dynamic content) in your template. If you do, create the variables by putting $ around the name (ie $Value$).
- Determine if you want your variable to use a macro. If so, choose one fro the list on the right.
- Time to use your new LiveTemplate
Go back to your coding window and type in the shortcut you gave your template (ie ateq) and watch as code is generated.
There you go, 5 simple steps to creating and using a LiveTemplate. You should not be much more productive and be able to code circles around your fellow developers.
Till next time,
[----- Remember to check out DimeCasts.Net -----]
06-18-2008 10:37 AM