From 8d04e5d459140715940a5002249bf66a057181ab Mon Sep 17 00:00:00 2001 From: akhera99 Date: Fri, 27 May 2022 14:12:52 -0700 Subject: [PATCH] fix assumption of length --- .../Core.Wpf/InlineHints/InlineHintsTagger.cs | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTagger.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTagger.cs index a793dd599083c..6122ef61d7858 100644 --- a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTagger.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTagger.cs @@ -151,19 +151,23 @@ public IEnumerable> GetTags(NormalizedSnapshotSp var selectedSpans = new List>(); for (var i = 0; i < _cache.Count; i++) { - var tagSpan = _cache[i].mappingTagSpan.Span.GetSpans(snapshot)[0]; - if (spans.IntersectsWith(tagSpan)) + var tagSpans = _cache[i].mappingTagSpan.Span.GetSpans(snapshot); + if (tagSpans.Count == 1) { - if (_cache[i].tagSpan is not { } hintTagSpan) + var tagSpan = tagSpans[0]; + if (spans.IntersectsWith(tagSpan)) { - var hintUITag = InlineHintsTag.Create( - _cache[i].mappingTagSpan.Tag.Hint, Format, _textView, tagSpan, _taggerProvider, _formatMap, classify); + if (_cache[i].tagSpan is not { } hintTagSpan) + { + var hintUITag = InlineHintsTag.Create( + _cache[i].mappingTagSpan.Tag.Hint, Format, _textView, tagSpan, _taggerProvider, _formatMap, classify); - hintTagSpan = new TagSpan(tagSpan, hintUITag); - _cache[i] = (_cache[i].mappingTagSpan, hintTagSpan); - } + hintTagSpan = new TagSpan(tagSpan, hintUITag); + _cache[i] = (_cache[i].mappingTagSpan, hintTagSpan); + } - selectedSpans.Add(hintTagSpan); + selectedSpans.Add(hintTagSpan); + } } }