Extending "Go To Definition" in 6.0 SDK

I'm looking for some documentation or example of extending the Go To Definition functionality of resharper. What type of provider do I need to implement to add results to Go To Definition in C#?

Secondary question, since the documentation is so incomplete, is it acceptable to use a tool like ILSpy on the resharper binaries to see example implementations for some features?

3 comments
Comment actions Permalink

Figured this out, after much experimenting (and digging in the Psi sample). Here are the interfaces I had to implement:


ILanguage

IDeclaredElement (should contain all data used to navigate to definition)
DeclaredElementType

IDeclaredElementPresenter
IOccurence

IOccurencePresenter
IDeclarationContextSearch

I wanted to just implement IDeclarationContextSearch, IOccurrence, and IOccurencePresenter, but there is some hard-coded logic somewhere that creates DeclaredElementOccurences for the menu item presentation step instead of calling custom code to generate the occurence.

0
Comment actions Permalink

Hi Jonathan. We prefer dotPeek, but yes, that's absolutely acceptable - in fact, it's pretty much essential. ReSharper prefers to allow plugin developers to use the same APIs that ReSharper itself uses, rather than provide a restricted plugin API. That means the API surface is as large as ReSharper itself, and providing full documentation is very difficult, although we are always trying to improve that situation. In the meantime, using a tool like dotPeek or ILSpy is a good way to explore the API.

Thanks
Matt

0
Comment actions Permalink

This is very good to hear! I will give dotPeek a shot. And yes, the more I use (or attempt to use) the ReSharper APIs the more I realize how enormous it is.

0

Please sign in to leave a comment.