public ITagger <T> CreateTagger <T>(ITextView textView, ITextBuffer buffer) where T : ITag { if (textView == null) { throw new ArgumentNullException("textView"); } if (buffer == null) { throw new ArgumentNullException("buffer"); } if (buffer != textView.TextBuffer) { return(null); } ITagger <T> tagger = null; BackgroundCompilation compilation = buffer.Properties.GetOrCreateSingletonProperty(typeof(BackgroundCompilation), () => new BackgroundCompilation(this, buffer)); compilation.CompilationChanged += CompilationChanged; if (typeof(T) == typeof(IErrorTag)) { tagger = (ITagger <T>)buffer.Properties.GetOrCreateSingletonProperty(typeof(CompilationErrorTagger), () => new CompilationErrorTagger(this, compilation)); } else if (typeof(T) == typeof(IClassificationTag)) { tagger = (ITagger <T>)buffer.Properties.GetOrCreateSingletonProperty(typeof(CompilationSymbolTagger), () => new CompilationSymbolTagger(this, compilation)); } return(tagger); }
public CompilationTagger(CompilationTaggerProvider taggerProvider, BackgroundCompilation backgroundCompilation) { this.taggerProvider = taggerProvider; this.backgroundCompilation = backgroundCompilation; this.backgroundCompilation.CompilationChanged += CompilationChanged; }
public CompilationSymbolTagger(CompilationTaggerProvider taggerProvider, BackgroundCompilation backgroundCompilation) : base(taggerProvider, backgroundCompilation) { }
public CompilationErrorTagger(CompilationTaggerProvider taggerProvider, BackgroundCompilation backgroundCompilation) : base(taggerProvider, backgroundCompilation) { this.Factory = new CompilationErrorsFactory(this, new CompilationErrorsSnapshot(backgroundCompilation.FilePath, 0, backgroundCompilation.CompilationSnapshot)); taggerProvider.AddCompilationErrorsFactory(this.Factory); }