File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -98,10 +98,20 @@ private void CaretPositionChanged(object sender, CaretPositionChangedEventArgs e
9898 UpdateAtCaretPosition ( e . NewPosition ) ;
9999 }
100100
101+ private void ClearSpans ( )
102+ {
103+ lock ( _syncLock )
104+ {
105+ _currentWord = null ;
106+ _wordSpans = new ( ) ;
107+ SnapshotSpan span = new ( _buffer . CurrentSnapshot , 0 , _buffer . CurrentSnapshot . Length ) ;
108+ TagsChanged ? . Invoke ( this , new SnapshotSpanEventArgs ( span ) ) ;
109+ }
110+ }
101111 private void UpdateAtCaretPosition ( CaretPosition caretPosition )
102112 {
103113 SnapshotPoint ? point = caretPosition . Point . GetPoint ( _buffer , caretPosition . Affinity ) ;
104-
114+
105115 if ( ! point . HasValue )
106116 {
107117 return ;
@@ -117,6 +127,13 @@ private void UpdateAtCaretPosition(CaretPosition caretPosition)
117127 UpdateWordAdornments ( word . Value ) ;
118128 } , VsTaskRunContext . UIThreadIdlePriority ) . FireAndForget ( ) ;
119129 }
130+ else
131+ {
132+ // Clear the spans, to make sure that the highlights are
133+ // removed when we move the caret to whitespace
134+ ClearSpans ( ) ;
135+ }
136+
120137 }
121138
122139 private void UpdateWordAdornments ( TextExtent word )
You can’t perform that action at this time.
0 commit comments