I want to write a visual studio 2010 extension displaying a margin glyph on each class, method, property, field and event definition (tooltip/popup window on click with addition开发者_如何学JAVAal info).
The new MEF based framework is really neat but the only thing I can tag in order to create margin glyphs are snapshotspans. unfortunately they dont have any sort of code model or structuring and i am forced to search for class names, etc. by string parsing => absolutely not what i want to do.
We found out that we can use
[Import]
internal SVsServiceProvider ServiceProvider;
to retreive a DTE object for the current document. Unfortunately we still have problems to call fileCodeModel.CodeElementFromPoint()
because we have no TextPoint object.
Does somebody know how to convert a SnapshotSpan to a TextPoint?
Is there any other way to directly tag the code model instead of the text? Only thing I found on google has been: Visual Studio Extensibility / Margins - also forgeting about how to convert from SnapshotSpan to TextPoint : (
Best regards. D.R.
I don't know how to do this myself, but you might be able to figure it out by looking at the code to RapidMEF.
精彩评论