Help with SDK

Hi,
I have been working on a little plug-in (internal use only for now). Thanks for providing a SDK. However, wihle the documentation is increasing, my progress has been painfully slow due to the lack of documentation. I have a few questions:

  1. Is this the official place to get some help?
  2. If not, where can I get some help with the API?



If this is the right place, then here is what I am trying to accomplish:
Our product has been around for a few years. It has accumulated a lot of public API that we must either document or exclude from our documentation system. The latter being more efficient at this point, I am creating a Resharper plug-in that would do that for us on a massive scale. The idea here is that this "action" would be available at the solution, project, folder or file level and would allow to "exclude members from documentation". What this means for us is that we will be adding some special markup to the C# XML docs of a class member declaration for our code (at least an "/// <exclude/>" line). Thanks to Agent Smith, I think am now able to perform the last part and it works well.
However, this is currently implemented as a context action, quick-fix (not really sure I have wrapped my head around the nuances so far...). This is not really efficient since you must navigate from one declaration to the next (we have thousands of classes and members).

So, I am at the point where I want to try to perform this at a higher level (say from a project level). But I am struggling with getting from "the user selects a solution/project/file" to "I have a IClassMemberDeclaration". I think I am able to get to the IProjectFile, but then, how do I inspect a file and find its declarartions and all? or am I doing this all wrong?

I would love to keep this discussion going so other members can benefit from those answers. However, if it is more efficient for someone to contact me directly, please feel free to do so. I am desparate at this point.

Regards,

Eric.

2 comments
Comment actions Permalink

Hi there!  First of all, I think that the Context Action/Quick-Fix approach is not right for you, because these things are only available in a particular opened file. What you need instead is a Code Cleanup action. There's actually an example of code cleanup in the SDK (in the SamplePlugin project) that should hopefully be of use in demonstrating how to set one up. Specifically, the file you should check out is UseIntConstantsInsteadOfLiterals.cs.

As far as declarations are concerned, you certainly do not have to go and analyze project files in your own code, since ReSharper already has the infrastructure for you to do this. In the example from the above file, you can call call file.ProcessChildren<T>() where T is the type you're after, e.g. IClassMemberDeclaration. This is a recursive operation, and the lambda you pass into this method lets you modify the declaration how you see fit.

Hope this helps,

Dmitri

0
Comment actions Permalink

Thanks Dmitri, this definitely helped a bunch. It now just works :)
I will most likely be pinging you in the coming days to validate that what I am doing is correct. But, for now, it may not be fast, it may not be how it's supposed to be done, but it does what I am looking for!

Thanks again,

Eric.

0

Please sign in to leave a comment.