I wanted to verify few design patterns in C# code by static analysis. I found that by creating a plugin for Resharper I can verify the patterns on-the-fly while i am coding. But I did not find good documentation re开发者_如何学JAVAlated to its open APIs. Are there any links where I can find suitable documentation.
I Am using MVVM pattern so i want to verify that View-Model classes are not having any dependency with UI classes or elements (WPF elements).
ReSharper 5 introduced the Pattern Catalog AKA Structural Search and Replace. It allows you to create Quick Fixes and Context Actions easily without writing your own ReSharper plug-in. I would recommend checking it out to see if it will suffice for your needs before delving into writing a plug-in. You can find an overview here:
http://blogs.jetbrains.com/dotnet/2010/04/introducing-resharper-50-structural-search-and-replace/
JetBrains also provides a sample catalog, which showcases some cool things that you can do, on their download page:
http://www.jetbrains.com/resharper/download/index.html
This article looks like it might help. There's a walkthrough for creating a context-aware plugin. It's continued here.
I reckon the second article is most relevant to you as it covers using the visitor pattern to hook into the ReSharper daemons - and perform some useful work.
This page is the root of the Open API documentation.
HTH
The documentation is currently somewhat fragmented. To get you started, take a look at the ReSharper Extensibility Guide which I think targets version 4.5 but is still a good start. As the other poster mentioned, Hadi Hariri's blog is a good source for finding information on ReSharper plugin writing. Also, check out the ReSharper PowerToys for some sample code.
Finally, there are (very few, as yet) articles on ReSharper 6 plugin development available here. More content will be added soon.
精彩评论