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); + } } }