Saturday 15 September 2012

add in - Highlight text from Visual Studio 2008 add-in -


I am writing another code coverage tool for .NET with the integration of Visual Studio 2008. Everything goes well except one thing: I can not find any way to highlight some code sections.

I need this to inform the user about the blocks covered and covered.
You can see an example of the feature that you want on the next screenshot. (From the native VS code coverage toolet):

Can someone provide me the code snippet that highlights the text in the code view window?

I have found the answer

>

, see the code given below:

  // Retrieving IVsTextManager and id Diet 2 applicationObject = ...; // Receive it during the Inline In Microsoft Microsoft. Visual Studio OLE.Interop.IServiceProvider serviceProvider = (Microsoft.VisualStudio.OLE.Interop.IServiceProvider) applicationObject; Guid SID = typeof (SVsTextManager) Dog; Guid Iid = Typ (IVsTextManager). IntPtr output; ServiceProvider.QueryService (Referred SID, Ref IID, Out output); IVsTextManagerTermmanager = (IVsTextManager) Marshall. GetObjectForIUnknown (output); Int Highlight; Guide Hightguide = ...; // Your highlighted text style GUIDE text MANAGER.GetRegisteredMarkerTypeID (Ref Highlight, Out Highlighted AID); // Highlighting Text Block in Active View IVsTextView View; Int result = text manager. GetActiveView (0, blank, see out); IVsTextLines buffer; See. Getbuffer (outside buffer); Buffer Creteline Marker (Highlights, Startlines, Start Columns, Endlines, And Columns, Blanks, Blanks);  

More examples can be found.


No comments:

Post a Comment