Finding the Class Declarations in an ICSharpFile
Hi, I'm struggling to make sense of the hierarchy of documents whilst writing my plugin. I'm writing a custom macro for a live template that will pull out the description from a classes Summary XML documentation (in bold):
/// <summary>
/// Retrieves the summary text from a types documentation
/// </summary>
I have the following code already to obtain a reference to the file that called the macro:
IPsiSourceFile psiSourceFile = context.SessionContext.Document.GetPsiSourceFile(context.SessionContext.Solution);
var psiLanguageType = MacroUtil.GetLanguageType(context);
var file = psiSourceFile.GetPsiFile(psiLanguageType);
I have the reference to the file - how to I pull out the first class declaration (or all the class declarations) from the document? The file object here gives me the ability to read the namespaces - but not anything further.
I'm using Resharper 6 - andmust admit I am finding it heavy going without XML documentation of many of the objects and no document modal documentation that I could find. :(
Any help is appreciated.
Please sign in to leave a comment.
Thankyou for the reply Matt. Could you point me in the direction of where any of this is documented please?
Would you also be kind enough to post some demo code that I would use to navigate an ICSharpFile to find node of a certain type? It's not without trying that I've tried to find this kind of information.