Tuesday, October 13, 2009

Adding Resharper’s User File Template in the quick list

I tried to add a new file template for Resharper (shortcut ALT-INS in the solution explorer).  The template was for creating a new test class for MbUnit test framework.  Everything worked fine except that my new file template did not appear in the quick list.

I’ve looked online and found this post on Vadim’s blog, he was doing the exact same template that I was doing!!

Anyway, I’ve tried to call my new template via the Resharper menu and I found this option on one screen:

image image

After that I was able to use my new file template from the quick list (ALT-INS)

image 

I hope I only overlook something because I think this option should be available on the File Template edition screen (or in the Option like it used to be, look at Vadim’s post).

Update!!

After a few days I finally found out the easy (yet not very intuitive) way to modify the quick list.

In the Templates Explorer – File Templates (menu Resharper –> Live Templates…) on the left side is the available templates and on the right side is a preview of the quick list for C#, VB and other project types. 

To add a new template to the quick list simply drag the template on the left and drop it on the right side on the position you want.  To remove a template from the quick list just select it and click the delete button in the toolbar.

image

If you are curious here is my own File Template for MbUnit test fixture class

using System;

using MbUnit.Framework;

namespace $NAMESPACE$
{
[TestFixture]
public sealed class $CLASS$
{
#region Constructor

public $CLASS$()
{
}

#endregion

#region Test Methods

[Test]
public void Test()
{
$END$
}

#endregion
}
}




1 comment:

Unknown said...

Sorry for the code formatting I'll try to find a better plugin