// TODO: Consider reworking this mechanism to be built upon events public void RegisterTagger(HighlightTagger tagger) { List <HighlightTagger> taggers; if (this.bufferToTaggersMap.TryGetValue(tagger.Buffer, out taggers)) { taggers.Add(tagger); } else { taggers = new List <HighlightTagger>() { tagger }; this.bufferToTaggersMap.Add(tagger.Buffer, taggers); } List <HighlightEventArgs> pendingEvents; if (this.bufferToPendingEventsMap.TryGetValue(tagger.Buffer, out pendingEvents)) { foreach (var pendingEvent in pendingEvents) { tagger.HighlightText(pendingEvent.Snapshot, pendingEvent.Highlights); } this.bufferToPendingEventsMap.Remove(tagger.Buffer); } }
public void UnregisterTagger(HighlightTagger tagger) { this.bufferToTaggersMap[tagger.Buffer].Remove(tagger); }