Skip to content

Commit 942cfa7

Browse files
1 letter identifiers can now also be highlighted
1 parent e81bde6 commit 942cfa7

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/toolkit/Community.VisualStudio.Toolkit.Shared/MEF/SameWordHighlighterBase.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ public class SameWordHighlighterBase : IViewTaggerProvider
2525
/// </summary>
2626
public virtual string TextMarkerTagType => "MarkerFormatDefinition/HighlightWordFormatDefinition";
2727
/// <summary>
28-
/// The Options that are used to find the matching words. The default implementation returns
28+
/// The Options that are used to find the matching words. The default implementation returns
2929
/// FindOptions.WholeWord | FindOptions.MatchCase
3030
/// </summary>
3131
public virtual FindOptions FindOptions => FindOptions.WholeWord | FindOptions.MatchCase;
3232
/// <summary>
33-
/// Filter the results.
33+
/// Filter the results.
3434
/// </summary>
3535
/// <param name="results">Collection of the results</param>
3636
/// <returns>Filtered list of results. The default implementation returns all the results</returns>
@@ -48,7 +48,7 @@ public ITagger<T> CreateTagger<T>(ITextView textView, ITextBuffer buffer) where
4848
{
4949
ITextStructureNavigator? navigator = _textStructureNavigatorSelector?.GetTextStructureNavigator(textView.TextBuffer);
5050

51-
return (ITagger<T>)buffer.Properties.GetOrCreateSingletonProperty(() =>
51+
return (ITagger<T>)buffer.Properties.GetOrCreateSingletonProperty(() =>
5252
new SameWordHighlighterTagger(textView, buffer, _textSearchService, navigator, this));
5353
}
5454
}
@@ -71,7 +71,7 @@ internal class SameWordHighlighterTagger : ITagger<HighlightWordTag>, IDisposabl
7171
private bool _isDisposed;
7272
private readonly object _syncLock = new();
7373

74-
public SameWordHighlighterTagger(ITextView view, ITextBuffer sourceBuffer, ITextSearchService? textSearchService,
74+
public SameWordHighlighterTagger(ITextView view, ITextBuffer sourceBuffer, ITextSearchService? textSearchService,
7575
ITextStructureNavigator? textStructureNavigator, SameWordHighlighterBase tagger)
7676
{
7777
_view = view;
@@ -111,7 +111,7 @@ private void ClearSpans()
111111
private void UpdateAtCaretPosition(CaretPosition caretPosition)
112112
{
113113
SnapshotPoint? point = caretPosition.Point.GetPoint(_buffer, caretPosition.Affinity);
114-
114+
115115
if (!point.HasValue)
116116
{
117117
return;
@@ -120,7 +120,7 @@ private void UpdateAtCaretPosition(CaretPosition caretPosition)
120120
_requestedPoint = point.Value;
121121
TextExtent? word = _textStructureNavigator?.GetExtentOfWord(_requestedPoint);
122122

123-
if (word.HasValue && word.Value.IsSignificant && word.Value.Span.Length > 1)
123+
if (word.HasValue && word.Value.IsSignificant && word.Value.Span.Length > 0)
124124
{
125125
ThreadHelper.JoinableTaskFactory.StartOnIdleShim(() =>
126126
{
@@ -129,8 +129,8 @@ private void UpdateAtCaretPosition(CaretPosition caretPosition)
129129
}
130130
else
131131
{
132-
// Clear the spans, to make sure that the highlights are
133-
// removed when we move the caret to whitespace
132+
// Clear the spans, to make sure that the highlights are
133+
// removed when we move the caret to whitespace
134134
ClearSpans();
135135
}
136136

0 commit comments

Comments
 (0)