Chapter 7. Extending ReSharper

ReSharper comes with a robust set of features; users are able to add new features to it according to their needs. This chapter serves as a basic introduction to extending ReSharper and is a step-by-step guide for creating a sample plugin.

In this chapter, we will explain:

  • Why you should extend ReSharper
  • How the ReSharper API looks
  • What the Internal mode is and how to enable the ReSharper Internal mode
  • How to create your own plugin

Additionally, we will quickly go through a sample project provided with the ReSharper SDK.

ReSharper provides a couple of ways to extend its functionality; in this chapter, we will focus on writing plugins.

Why you should extend ReSharper

When we talk about extending ReSharper, you might wonder why you should do this. As ReSharper extends Visual Studio, why should you extend ReSharper and not Visual Studio?

To answer this, let's check how we can extend ReSharper. The following are the four ways to do it:

  • Live templates
  • Structural Search and Replace
  • External annotations
  • Plugins

We have already described the first two methods in the previous chapters. They just provide new rules to the existing ReSharper features, so this gives us a clear picture about why they are related to extending ReSharper. The same is the case with external annotations; they provide new rules for the code analysis feature.

Note

External annotations are not in the scope of this book. You can read more about this topic on the ReSharper Web Help page at http://www.jetbrains.com/resharper/webhelp/Code_Analysis__External_Annotations.html.

The last option, that is, plugins, are the most powerful as they are not strongly associated with just one feature. They do not even need to be related to ReSharper.

So, the question arises, why should you write plugins for ReSharper? The answer is, because it is easy. ReSharper comes with a very extensive API, which provides many useful features. Of course, we do not think that writing plugins for Visual Studio does not make sense. However, sometimes it is much easier to use features that already exist in ReSharper than write a custom one from scratch.

In your plugin, you can do everything that ReSharper does as you have access to the same API. With your plugin, you can not only create some new features but also add support for new languages or a new unit test framework.

The only disadvantage when we are thinking about plugins for ReSharper is that it limits the number of potential users, and our users need to have ReSharper.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.148.104.242