1

This is in reference to writing a Visual Studio extension or MEF.

MS Walkthrough: Creating a Margin Glyph example

https://msdn.microsoft.com/en-us/library/ee361745.aspx

How do you toggle a margin glyph via a tool window button?

So click button... glyph disappears, click button... glyph reappears (at location of cursor).

The issue is getting a margin glyph to redraw, refresh or re-render on command.

So for the purposes of this question, you can assume my project is identical to the MS Walkthrough linked at the top.

How do you get a glyph to update?

sthede
  • 914
  • 1
  • 8
  • 27

2 Answers2

1

If you're following the pattern described there, you should raise the TagsChanged event with the appropriate span from the tagger object.

Jason Malinowski
  • 18,148
  • 1
  • 38
  • 55
1

Here is link to an answer that I had to a similar question. First take a look at the Implementing a Brace Matching Tagger Provider section in Walkthrough: Displaying Matching Braces example to change using a ITaggerProvider to IViewTaggerProvider. Then you can call

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

to explicitly call GetTags for the spans in the current snapshot.

nicooo21
  • 158
  • 8