-
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The HighLigth word feature stopped working after the window was split…
… and unsplit or after the preview margin was shown because these all share the same buffer. We now add a counter to the SameWordHighlighterTagger and when the Counter reaches zero then the tagger stops tagging. Also added a HighlightWord tagger to the example project that tags words inside text documents.
- Loading branch information
1 parent
a6a7b50
commit 50398a7
Showing
3 changed files
with
44 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using Microsoft.VisualStudio.Text.Operations; | ||
using Microsoft.VisualStudio.Text.Tagging; | ||
using Microsoft.VisualStudio.Utilities; | ||
using Community.VisualStudio.Toolkit; | ||
using System.ComponentModel.Composition; | ||
using Microsoft.VisualStudio.Text.Editor; | ||
|
||
namespace TestExtension.MEF | ||
{ | ||
/// <summary> | ||
/// This class demonstrates a HighlightWord tagger for text files | ||
/// and it only highlights whole words starting with a Letter | ||
/// </summary> | ||
[Export(typeof(IViewTaggerProvider))] | ||
[ContentType("Text")] | ||
[TagType(typeof(TextMarkerTag))] | ||
[TextViewRole(PredefinedTextViewRoles.PrimaryDocument)] | ||
internal class HighlightWordTaggerProvider : SameWordHighlighterBase | ||
{ | ||
public override FindOptions FindOptions => FindOptions.WholeWord; | ||
public override bool ShouldHighlight(string text) | ||
{ | ||
if (text?.Length > 0) | ||
return char.IsLetter(text[0]); | ||
return false; | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters