public IEnumerable <ITagSpan <TextMarkerTag> > GetTags(NormalizedSnapshotSpanCollection spans) { if (this.currentWord == null) { yield break; } var currentWord = this.currentWord.Value; var wordSpans = this.wordSpans; if (spans.Count == 0 || this.wordSpans.Count == 0) { yield break; } if (spans[0].Snapshot != wordSpans[0].Snapshot) { wordSpans = new NormalizedSnapshotSpanCollection( wordSpans.Select(span => span.TranslateTo(spans[0].Snapshot, SpanTrackingMode.EdgeExclusive))); currentWord = currentWord.TranslateTo(spans[0].Snapshot, SpanTrackingMode.EdgeExclusive); } if (spans.OverlapsWith(new NormalizedSnapshotSpanCollection(currentWord))) { yield return(new TagSpan <BraceHighlightWordTag>(currentWord, new BraceHighlightWordTag())); } foreach (var span in NormalizedSnapshotSpanCollection.Overlap(spans, wordSpans)) { yield return(new TagSpan <BraceHighlightWordTag>(span, new BraceHighlightWordTag())); } }
public IEnumerable <ITagSpan <HighlightWordClass> > GetTags(NormalizedSnapshotSpanCollection spans) { List <NormalizedSnapshotSpanCollection> wordSpansList = WordSpans; if (spans.Count == 0 || wordSpansList.Count == 0) { yield break; } for (int i = 0; i < wordSpansList.Count; ++i) { if (wordSpansList[i].Count == 0) { continue; } // If the requested snapshot isn't the same as the one our words are on, translate our spans to the expected snapshot if (spans[0].Snapshot != wordSpansList[i][0].Snapshot) { wordSpansList[i] = new NormalizedSnapshotSpanCollection( wordSpansList[i].Select(span => span.TranslateTo(spans[0].Snapshot, SpanTrackingMode.EdgeExclusive))); // currentWord = currentWord.TranslateTo(spans[0].Snapshot, SpanTrackingMode.EdgeExclusive); } // Second, yield all the other words in the file foreach (SnapshotSpan span in NormalizedSnapshotSpanCollection.Overlap(spans, wordSpansList[i])) { yield return(new TagSpan <HighlightWordClass>(span, new HighlightWordClass(i))); } } }
IEnumerable <ITagSpan <ProgressGlyphTag> > ITagger <ProgressGlyphTag> .GetTags(NormalizedSnapshotSpanCollection spans) { if (spans.Count == 0) { yield break; } var targetSnapshot = spans[0].Snapshot; List <SnapshotSpan> pre; List <SnapshotSpan> post; lock (this) { pre = bufferChangesPreVerificationStart.ToList(); post = bufferChangesPostVerificationStart.ToList(); } // If the requested snapshot isn't the same as the one our words are on, translate our spans to the expected snapshot var chs = new NormalizedSnapshotSpanCollection(pre.Select(span => span.TranslateTo(targetSnapshot, SpanTrackingMode.EdgeExclusive))); foreach (SnapshotSpan span in NormalizedSnapshotSpanCollection.Overlap(spans, chs)) { yield return(new TagSpan <ProgressGlyphTag>(span, new ProgressGlyphTag(0))); } chs = new NormalizedSnapshotSpanCollection(post.Select(span => span.TranslateTo(targetSnapshot, SpanTrackingMode.EdgeExclusive))); foreach (SnapshotSpan span in NormalizedSnapshotSpanCollection.Overlap(spans, chs)) { yield return(new TagSpan <ProgressGlyphTag>(span, new ProgressGlyphTag(1))); } }
public IEnumerable <ITagSpan <TextMarkerTag> > GetTags(NormalizedSnapshotSpanCollection spans) { if (_highlightedSpans?.Any() ?? false) { if (spans.First().Snapshot != _highlightedSpans.First().Snapshot) { _highlightedSpans = new NormalizedSnapshotSpanCollection( from span in _highlightedSpans select span.TranslateTo(spans.First().Snapshot, SpanTrackingMode.EdgeExclusive) ); } foreach (var span in NormalizedSnapshotSpanCollection.Overlap(spans, _highlightedSpans)) { yield return(new TagSpan <FrameNameReferenceTag>(span, FrameNameReferenceTag.Instance)); } } if (_definitionSpans?.Any() ?? false) { if (spans.First().Snapshot != _definitionSpans.First().Snapshot) { _definitionSpans = new NormalizedSnapshotSpanCollection( from span in _definitionSpans select span.TranslateTo(spans.First().Snapshot, SpanTrackingMode.EdgeExclusive) ); } foreach (var span in NormalizedSnapshotSpanCollection.Overlap(spans, _definitionSpans)) { yield return(new TagSpan <FrameNameDefinitionTag>(span, FrameNameDefinitionTag.Instance)); } } }
public IEnumerable <ITagSpan <B4SmartTag> > GetTags(NormalizedSnapshotSpanCollection spans) { NormalizedSnapshotSpanCollection wordSpans = _wordSpans; if (_wordSpans == null) { yield break; } if (spans.Count == 0 || wordSpans.Count == 0 || _codeModel == null) { yield break; } // If the requested snapshot isn't the same as the one our words are on, translate our spans to the expected snapshot if (spans[0].Snapshot != wordSpans[0].Snapshot) { wordSpans = new NormalizedSnapshotSpanCollection( wordSpans.Select(span => span.TranslateTo(spans[0].Snapshot, SpanTrackingMode.EdgeExclusive))); } // Second, yield all the other words in the file foreach (SnapshotSpan span in NormalizedSnapshotSpanCollection.Overlap(spans, wordSpans)) { yield return(new TagSpan <B4SmartTag>(span, new B4SmartTag(GetSmartTagActions(span)))); } }
public IEnumerable <ITagSpan <ClassificationTag> > GetTags(Microsoft.VisualStudio.Text.NormalizedSnapshotSpanCollection spans) { if (activeSpans == null) { yield break; } if (activeSpans.Count == 0 || spans.Count == 0) { yield break; } if (activeSpans[0].Snapshot != spans[0].Snapshot) { activeSpans = new NormalizedSnapshotSpanCollection( activeSpans.Select( span => span.TranslateTo(spans[0].Snapshot, SpanTrackingMode.EdgeExclusive) )); } foreach (var span in NormalizedSnapshotSpanCollection.Overlap(spans, activeSpans)) { yield return(new TagSpan <ClassificationTag>(span, new ClassificationTag(ClassificationType))); } }
public IEnumerable <ITagSpan <ClassificationTag> > GetTags(NormalizedSnapshotSpanCollection spans) { // Hold on to a "snapshot" of the word spans, so that we maintain the same // collection throughout NormalizedSnapshotSpanCollection wordSpans = WordSpans; if (spans.Count == 0 || WordSpans.Count == 0) { yield break; } // If the requested snapshot isn't the same as the one our words are on, translate our spans // to the expected snapshot if (spans[0].Snapshot != wordSpans[0].Snapshot) { wordSpans = new NormalizedSnapshotSpanCollection( wordSpans.Select(span => span.TranslateTo(spans[0].Snapshot, SpanTrackingMode.EdgeExclusive))); } // Yield all the replacement spans in the file foreach (SnapshotSpan span in NormalizedSnapshotSpanCollection.Overlap(spans, wordSpans)) { yield return(new TagSpan <ClassificationTag>(span, new ClassificationTag(classificationType))); } }
public IEnumerable <ITagSpan <TextMarkerTag> > GetTags(NormalizedSnapshotSpanCollection spans) { if (CurrentWord == null) { yield break; } // Hold on to a "snapshot" of the word spans and current word, so that we maintain the same // collection throughout SnapshotSpan currentWord = CurrentWord.Value; NormalizedSnapshotSpanCollection wordSpans = WordSpans; if (spans.Count == 0 || wordSpans.Count == 0) { yield break; } // If the requested snapshot isn't the same as the one our words are on, translate our spans to the expected snapshot if (spans[0].Snapshot != wordSpans[0].Snapshot) { wordSpans = new NormalizedSnapshotSpanCollection( wordSpans.Select(span => span.TranslateTo(spans[0].Snapshot, SpanTrackingMode.EdgeExclusive))); currentWord = currentWord.TranslateTo(spans[0].Snapshot, SpanTrackingMode.EdgeExclusive); } // First, yield back the word the cursor is under (if it overlaps) // Note that we'll yield back the same word again in the wordspans collection; // the duplication here is expected. if (spans.OverlapsWith(new NormalizedSnapshotSpanCollection(currentWord))) { yield return(new TagSpan <CurrentWordTag>(currentWord, new CurrentWordTag())); } // Second, yield all the other words in the file foreach (SnapshotSpan span in NormalizedSnapshotSpanCollection.Overlap(spans, wordSpans)) { if (span == currentWord) { yield return(new TagSpan <CurrentWordTag>(currentWord, new CurrentWordTag())); } else { yield return(new TagSpan <HighlightWordTag>(span, new HighlightWordTag())); //var line = span.Snapshot.GetLineFromPosition(span.Start.Position); //var length = span.Start.Position - line.Start.Position; //var lineUpToWord = line.GetText().Substring(0, length); //if (lineUpToWord.Contains('!')) //{ // yield return new TagSpan<HighlightWordInCommentTag>(span, new HighlightWordInCommentTag()); //} } } }
public IEnumerable <ITagSpan <TextMarkerTag> > GetTags(NormalizedSnapshotSpanCollection spans) { if (CurrentWord == null) { yield break; } // Hold on to a "snapshot" of the word spans and current word, so that we maintain the same // collection throughout var currentWord = CurrentWord.Value; var wordSpans = YellowWordSpans; if (wordSpans.Count > 0) { if (spans.Count == 0 || wordSpans.Count == 0) { yield break; } // If the requested snapshot isn't the same as the one our words are on, translate our spans to the expected snapshot if (spans[0].Snapshot != wordSpans[0].Snapshot) { wordSpans = new NormalizedSnapshotSpanCollection( wordSpans.Select(span => span.TranslateTo(spans[0].Snapshot, SpanTrackingMode.EdgeExclusive))); currentWord = currentWord.TranslateTo(spans[0].Snapshot, SpanTrackingMode.EdgeExclusive); } foreach (var span in NormalizedSnapshotSpanCollection.Overlap(spans, wordSpans)) { yield return(new TagSpan <TextMarkerTag>(span, new LowlightWordTag())); } } wordSpans = RedWordSpans; if (spans.Count == 0 || wordSpans.Count == 0) { yield break; } // If the requested snapshot isn't the same as the one our words are on, translate our spans to the expected snapshot if (spans[0].Snapshot != wordSpans[0].Snapshot) { wordSpans = new NormalizedSnapshotSpanCollection( wordSpans.Select(span => span.TranslateTo(spans[0].Snapshot, SpanTrackingMode.EdgeExclusive))); currentWord = currentWord.TranslateTo(spans[0].Snapshot, SpanTrackingMode.EdgeExclusive); } foreach (var span in NormalizedSnapshotSpanCollection.Overlap(spans, wordSpans)) { yield return(new TagSpan <TextMarkerTag>(span, new HighlightWordTag())); } }
public IEnumerable <ITagSpan <ClassificationTag> > GetTags(NormalizedSnapshotSpanCollection spans) { if (spans == null || spans.Count == 0 || m_CurrentSpans == null || m_CurrentSpans.Count == 0 || m_CurrentSpans[0].Snapshot != spans[0].Snapshot) { yield break; } foreach (SnapshotSpan span in NormalizedSnapshotSpanCollection.Overlap(spans, m_CurrentSpans)) { yield return(new TagSpan <ClassificationTag>(span, m_Tag)); } }
public IEnumerable <ITagSpan <HighlightWordTag> > GetTags(NormalizedSnapshotSpanCollection spans) { if (_currentWord == null) { yield break; } // Hold on to a "snapshot" of the word spans and current word, so that we maintain the same // collection throughout SnapshotSpan currentWord = _currentWord.Value; NormalizedSnapshotSpanCollection wordSpans = _wordSpans; if (spans.Count == 0 || _wordSpans.Count == 0) { yield break; } // If the requested snapshot isn't the same as the one our words are on, translate our spans to the expected snapshot if (spans[0].Snapshot != wordSpans[0].Snapshot) { wordSpans = new NormalizedSnapshotSpanCollection( wordSpans.Select(span => span.TranslateTo(spans[0].Snapshot, SpanTrackingMode.EdgeExclusive))); currentWord = currentWord.TranslateTo(spans[0].Snapshot, SpanTrackingMode.EdgeExclusive); } NormalizedSnapshotSpanCollection words = NormalizedSnapshotSpanCollection.Overlap(spans, wordSpans); if (words.Count == 1) { yield break; } // First, yield back the word the cursor is under (if it overlaps) // Note that we'll yield back the same word again in the wordspans collection; // the duplication here is expected. if (spans.OverlapsWith(new NormalizedSnapshotSpanCollection(currentWord))) { yield return(new TagSpan <HighlightWordTag>(currentWord, new HighlightWordTag())); } // Second, yield all the other words in the file foreach (SnapshotSpan span in words) { yield return(new TagSpan <HighlightWordTag>(span, new HighlightWordTag())); } }
/// <summary> /// Find every instance of CurrentWord in the given span /// </summary> /// <param name="spans">A read-only span of text to be searched for instances of CurrentWord</param> public IEnumerable <ITagSpan <HighlightWordTag> > GetTags(NormalizedSnapshotSpanCollection spans) { if (this.CurrentWord == null) { yield break; } if ((spans.Count == 0) || (this.wordSpans_.Count == 0)) { yield break; } // Hold on to a "snapshot" of the word spans and current word, so that we maintain the same // collection throughout SnapshotSpan currentWordLocal = this.currentWordSpan_.Value; NormalizedSnapshotSpanCollection wordSpansLocal = this.wordSpans_; // If the requested snapshot isn't the same as the one our words are on, translate our spans // to the expected snapshot if (spans[0].Snapshot != wordSpansLocal[0].Snapshot) { wordSpansLocal = new NormalizedSnapshotSpanCollection( wordSpansLocal.Select(span => span.TranslateTo(spans[0].Snapshot, SpanTrackingMode.EdgeExclusive))); currentWordLocal = currentWordLocal.TranslateTo(spans[0].Snapshot, SpanTrackingMode.EdgeExclusive); } //Debug.WriteLine("INFO: GetTags: currentWord=" + currentWordLocal.GetText()); // First, yield back the word the cursor is under (if it overlaps) // Note that we'll yield back the same word again in the word spans collection; // the duplication here is expected. if (spans.OverlapsWith(new NormalizedSnapshotSpanCollection(currentWordLocal))) { yield return(new TagSpan <HighlightWordTag>(currentWordLocal, new HighlightWordTag())); } // Second, yield all the other words in the file foreach (SnapshotSpan span in NormalizedSnapshotSpanCollection.Overlap(spans, wordSpansLocal)) { yield return(new TagSpan <HighlightWordTag>(span, new HighlightWordTag())); } }
public IEnumerable <ITagSpan <HighlightWordTag> > GetTags(NormalizedSnapshotSpanCollection spans) { if (spans.Count == 0 || !highlightedSpans.Any()) { yield break; } var highSpans = this.highlightedSpans; if (highSpans[0].Snapshot != spans[0].Snapshot) { highSpans = new NormalizedSnapshotSpanCollection(highSpans.Select(s => s.TranslateTo(spans[0].Snapshot, SpanTrackingMode.EdgeExclusive))); } foreach (SnapshotSpan span in NormalizedSnapshotSpanCollection.Overlap(spans, highSpans)) { yield return(new TagSpan <HighlightWordTag>(span, new HighlightWordTag())); } }
private IEnumerable <ITagSpan <IClassificationTag> > GetTags(NormalizedSnapshotSpanCollection spans, NormalizedSnapshotSpanCollection wordSpans, string classificationType) { if (!_options.OccurrenceTaggingEnabled || wordSpans == null || wordSpans.Count == 0 || spans.Count == 0) { return(Enumerable.Empty <ITagSpan <IClassificationTag> >()); } if (spans[0].Snapshot != wordSpans[0].Snapshot) { wordSpans = new NormalizedSnapshotSpanCollection(wordSpans.Select(s => s.TranslateTo(spans[0].Snapshot, SpanTrackingMode.EdgeInclusive))); } var caretPoint = _view.Caret.Position.Point.GetPoint(_sourceBuffer, _view.Caret.Position.Affinity); var ret = NormalizedSnapshotSpanCollection.Overlap(spans, wordSpans) .Where(s => !caretPoint.HasValue || caretPoint.Value < s.Start || s.End < caretPoint.Value) .Select(s => new TagSpan <IClassificationTag>(s, new ClassificationTag(_classificationTypes[classificationType]))); return(ret); }
public IEnumerable <ITagSpan <CssClassReferenceTag> > GetTags(NormalizedSnapshotSpanCollection spans) { var actual = _highlightedSpans; if (actual?.Any() ?? false) { if (spans.First().Snapshot != actual.First().Snapshot) { actual = new NormalizedSnapshotSpanCollection( from span in actual select span.TranslateTo(spans.First().Snapshot, SpanTrackingMode.EdgeExclusive) ); } foreach (var span in NormalizedSnapshotSpanCollection.Overlap(spans, actual)) { yield return(new TagSpan <CssClassReferenceTag>(span, CssClassReferenceTag.Instance)); } } }
public IEnumerable <ITagSpan <InvalidKeyrefTag> > GetTags(NormalizedSnapshotSpanCollection spans) { NormalizedSnapshotSpanCollection wordSpans = this.HighlightedSpans; if (spans.Count == 0 || wordSpans == null || wordSpans.Count == 0) { yield break; } // If the requested snapshot isn't the same as the one our words are on, translate our spans to the expected snapshot if (spans[0].Snapshot != _loader.CurrentSnapshot) { wordSpans = new NormalizedSnapshotSpanCollection(wordSpans.Select(span => span.TranslateTo(spans[0].Snapshot, SpanTrackingMode.EdgeExclusive))); } foreach (SnapshotSpan span in NormalizedSnapshotSpanCollection.Overlap(spans, wordSpans)) { yield return(new TagSpan <InvalidKeyrefTag>(span, new InvalidKeyrefTag(PredefinedErrorTypeNames.Warning, string.Format("No reference target for keyref: {0}.", span.GetText())))); } }
/*public IEnumerable<ITagSpan<HighlightWordTag>> GetTags(NormalizedSnapshotSpanCollection spans) * { * //if (CurrentWord == null) * // yield break; * * // Hold on to a "snapshot" of the word spans and current word, so that we maintain the same * // collection throughout * //SnapshotSpan currentWord = CurrentWord.Value; * NormalizedSnapshotSpanCollection wordSpans = WordSpans; * * if (spans.Count == 0 || wordSpans.Count == 0 || FCM == null) * yield break; * * // If the requested snapshot isn't the same as the one our words are on, translate our spans to the expected snapshot * if (spans[0].Snapshot != wordSpans[0].Snapshot) * { * wordSpans = new NormalizedSnapshotSpanCollection( * wordSpans.Select(span => span.TranslateTo(spans[0].Snapshot, SpanTrackingMode.EdgeExclusive))); * * //currentWord = currentWord.TranslateTo(spans[0].Snapshot, SpanTrackingMode.EdgeExclusive); * } * * // First, yield back the word the cursor is under (if it overlaps) * // Note that we'll yield back the same word again in the wordspans collection; * // the duplication here is expected. * //if (spans.OverlapsWith(new NormalizedSnapshotSpanCollection(currentWord))) * // yield return new TagSpan<HighlightWordTag>(currentWord, new HighlightWordTag()); * * // Second, yield all the other words in the file * foreach (SnapshotSpan span in NormalizedSnapshotSpanCollection.Overlap(spans, wordSpans)) * { * yield return new TagSpan<HighlightWordTag>(span, new HighlightWordTag()); * } * }*/ public IEnumerable <ITagSpan <B4ErrorTag> > GetTags(NormalizedSnapshotSpanCollection spans) { NormalizedSnapshotSpanCollection wordSpans = WordSpans; if (spans.Count == 0 || wordSpans.Count == 0 || FCM == null) { yield break; } // If the requested snapshot isn't the same as the one our words are on, translate our spans to the expected snapshot if (spans[0].Snapshot != wordSpans[0].Snapshot) { wordSpans = new NormalizedSnapshotSpanCollection( wordSpans.Select(span => span.TranslateTo(spans[0].Snapshot, SpanTrackingMode.EdgeExclusive))); } // Second, yield all the other words in the file foreach (SnapshotSpan span in NormalizedSnapshotSpanCollection.Overlap(spans, wordSpans)) { yield return(new TagSpan <B4ErrorTag>(span, new B4ErrorTag(/*PredefinedErrorTypeNames.SyntaxError, */ (" - - -53453453")))); } }
public IEnumerable <ITagSpan <ClassificationTag> > GetTags(NormalizedSnapshotSpanCollection spans) { if (CurrentWord == null) { yield break; } // Hold on to a "snapshot" of the word spans and current word, so that the same collection is maintained throughout SnapshotSpan currentWord = CurrentWord.Value; NormalizedSnapshotSpanCollection wordSpans = WordSpans; if (spans.Count == 0 || WordSpans.Count == 0) { yield break; } // If the requested snapshot isn't the same as the one the words are on, translate the spans to the expected snapshot if (spans[0].Snapshot != wordSpans[0].Snapshot) { wordSpans = new NormalizedSnapshotSpanCollection(wordSpans.Select(span => span.TranslateTo(spans[0].Snapshot, SpanTrackingMode.EdgeExclusive))); currentWord = currentWord.TranslateTo(spans[0].Snapshot, SpanTrackingMode.EdgeExclusive); } // First, yield back the word the cursor is under (if it overlaps) // Note that this will yield back the same word again in the wordspans collection; the duplication here is expected. if (spans.OverlapsWith(new NormalizedSnapshotSpanCollection(currentWord))) { yield return(new TagSpan <ClassificationTag>(currentWord, new ClassificationTag(TypeService.GetClassificationType(Constants.FONT_FORMAT_NAME)))); } // Second, yield all the other words in the file foreach (SnapshotSpan span in NormalizedSnapshotSpanCollection.Overlap(spans, wordSpans)) { yield return(new TagSpan <ClassificationTag>(span, new ClassificationTag(TypeService.GetClassificationType(Constants.FONT_FORMAT_NAME)))); } }
public IEnumerable <ITagSpan <HighlightWordTag> > GetTags(NormalizedSnapshotSpanCollection spans) { if (CurrentWord == null) { yield break; } SnapshotSpan currentWord = CurrentWord.Value; NormalizedSnapshotSpanCollection wordSpans = WordSpans; if (spans.Count == 0 || WordSpans.Count == 0) { yield break; } if (spans[0].Snapshot != wordSpans[0].Snapshot) { wordSpans = new NormalizedSnapshotSpanCollection( wordSpans.Select(span => span.TranslateTo(spans[0].Snapshot, SpanTrackingMode.EdgeExclusive))); currentWord = currentWord.TranslateTo(spans[0].Snapshot, SpanTrackingMode.EdgeExclusive); } foreach (SnapshotSpan span in NormalizedSnapshotSpanCollection.Overlap(spans, wordSpans)) { yield return(new TagSpan <HighlightWordTag>(span, new HighlightWordTag())); } }
// Token: 0x06000019 RID: 25 RVA: 0x00002808 File Offset: 0x00000A08 public IEnumerable <ITagSpan <TextMarkerTag> > GetTags(NormalizedSnapshotSpanCollection spans) { for (int i = 0; i < HighlightedWordCollection.Instance.HighlightedWords.Count; i++) { if (HighlightedWordCollection.Instance.HighlightedWords[i] != null) { string HighlightWord = HighlightedWordCollection.Instance.HighlightedWords[i]; NormalizedSnapshotSpanCollection wordSpans = this.WordSpanMap[HighlightWord]; if (spans.Count != 0 && wordSpans.Count != 0) { if (spans[0].Snapshot != wordSpans[0].Snapshot) { wordSpans = new NormalizedSnapshotSpanCollection(from span in wordSpans select span.TranslateTo(spans[0].Snapshot, 0)); } foreach (SnapshotSpan span2 in NormalizedSnapshotSpanCollection.Overlap(spans, wordSpans)) { yield return(new TagSpan <TextMarkerTag>(span2, this.GetHighlightDefinition(i))); } } } } yield break; }