File tree 1 file changed +5
-1
lines changed
1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -142,7 +142,11 @@ public IEnumerable<ITagSpan<ClassificationTag>> GetTags(NormalizedSnapshotSpanCo
142
142
realStart = curSpan . Start . Position + token . StartIndex - multilinePrefixSize ;
143
143
realTokenLength = token . Text . Length ;
144
144
}
145
- var tokenSpan = new SnapshotSpan ( curSpan . Snapshot , new Span ( realStart , realTokenLength ) ) ;
145
+ // This little check is required because, we are sometimes called (eg. when copying in vs2015) on a span smaller than a whole line
146
+ var tokenRange = new Span ( realStart , realTokenLength ) . Intersection ( curSpan ) ;
147
+ if ( ! tokenRange . HasValue )
148
+ continue ;
149
+ var tokenSpan = new SnapshotSpan ( curSpan . Snapshot , tokenRange . Value ) ;
146
150
yield return new TagSpan < ClassificationTag > ( tokenSpan , new ClassificationTag ( _rustTypes [ Utils . LexerTokenToRustToken ( token . Text , token . Type ) ] ) ) ;
147
151
}
148
152
}
You can’t perform that action at this time.
0 commit comments