public ITagger <T> CreateTagger <T>(ITextView textView, ITextBuffer buffer) where T : ITag { if (s_paramStorageClassification == null) { s_paramStorageClassification = ClassificationRegistry.GetClassificationType("ParamStorageClassificationVisualD"); } if (textView == null) { throw new ArgumentNullException("textView"); } if (buffer == null) { throw new ArgumentNullException("buffer"); } if (buffer != textView.TextBuffer) { return(null); } return(ParamStorageAdornmentTagger.GetTagger( (IWpfTextView)textView, FormatMapService.GetEditorFormatMap(textView), new Lazy <ITagAggregator <ParamStorageTag> >( () => BufferTagAggregatorFactoryService.CreateTagAggregator <ParamStorageTag>(textView.TextBuffer))) as ITagger <T>); }
public void UpdateStcSpans() { int[] stcLocs; bool pending; int changeCount; ParamStorageAdornmentTagger.GetParameterStorageLocations(_fileName, out stcLocs, out pending, out changeCount); if (pending && _stcLocs != null) { return; } if (_pendingSnapshot == null && _changeCount == changeCount) { return; } if (stcLocs != null) { int j = 0; for (int i = 0; i + 2 < stcLocs.Length; i += 3) { if (stcLocs[i] >= 0 && stcLocs[i] <= 2) { if (stcLocs[i + 1] >= _currentSnapshot.LineCount) { continue; } var line = _currentSnapshot.GetLineFromLineNumber(stcLocs[i + 1] - 1); stcLocs[j] = stcLocs[i]; stcLocs[j + 1] = line.Start.Position + stcLocs[i + 2]; j += 2; } } Array.Resize(ref stcLocs, j); } _stcLocs = stcLocs; _changeCount = changeCount; if (!pending) { _pendingSnapshot = null; } }