0

In my VS 2015 extension, I need to add margin glyphs to number of line which is returned from a web service (Web service return only line numbers). MSDN contains following example which tracks the text in the editor and add margin glyphs accordingly, however this example represents more complex scenario and does not match my requirement, Please advise how to achieve this.

https://msdn.microsoft.com/en-us/library/ee361745%28v=vs.100%29.aspx?f=255&MSPPError=-2147217396

Bandara
  • 780
  • 8
  • 29

1 Answers1

0

Firstly, take a look at Implementing a Brace Matching Tagger Provider section in Walkthrough: Displaying Matching Braces example to change using a ITaggerProvider to IViewTaggerProvider. Once you receive your list from the web service, you can call

TagsChanged?.Invoke(this, new SnapshotSpanEventArgs(new SnapshotSpan(
    SourceBuffer.CurrentSnapshot, 0, SourceBuffer.CurrentSnapshot.Length)));

in your functions to explicitly call GetTags to go over the tags in the current snapshot. Below is an example of how you can then draw the glyphs in GetTags:

foreach (SnapshotSpan span in spans)
        {
                ITextSnapshotLine startLine = span.Start.GetContainingLine(); 
                int startLineNumber = startLine.LineNumber;

         // Draw glyph if startLineNumber is contained in your list ... 
nicooo21
  • 158
  • 8