Skip to content

Commit

Permalink
Change XmlHighlightEndTagTagger tags to match TagType attribute
Browse files Browse the repository at this point in the history
XmlHighlightEndTagTagger returned tags that didn't match the
type promised by the TagType attribute on XmlHighlightEndTagTaggerProvider,
which broke NavigateToHighlightReferenceCommandHandler.


Fixes #47 - XmlHighlightEndTagTagger doesn't implement
ITagger<NavigableHighlightTag>
  • Loading branch information
mhutch committed Jun 28, 2023
1 parent 23bdec6 commit 0669960
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Editor/HighlightReferences/HighlightTagger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ protected virtual void Dispose (bool disposing)
}

/// <summary>
/// Considers items to be indentical if they intersect
/// Considers items to be identical if they intersect
/// </summary>
class IntersectionComparer : IComparer<(TKind kind, SnapshotSpan location)>
{
Expand Down
16 changes: 8 additions & 8 deletions Editor/HighlightReferences/XmlHighlightEndTagTagger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Tagging;

using MonoDevelop.Xml.Dom;
using MonoDevelop.Xml.Editor.Completion;
using MonoDevelop.Xml.Editor.HighlightReferences;
using MonoDevelop.Xml.Editor.Tagging;
using MonoDevelop.Xml.Parser;

namespace MonoDevelop.MSBuild.Editor.HighlightReferences
{
class XmlHighlightEndTagTagger : HighlightTagger<ITextMarkerTag, ITextMarkerTag>
class XmlHighlightEndTagTagger : HighlightTagger<NavigableHighlightTag, NavigableHighlightTag>
{
readonly XmlParserProvider parserProvider;

Expand All @@ -31,7 +31,7 @@ public XmlHighlightEndTagTagger (
}

protected async override
Task<(SnapshotSpan sourceSpan, ImmutableArray<(ITextMarkerTag kind, SnapshotSpan location)> highlights)>
Task<(SnapshotSpan sourceSpan, ImmutableArray<(NavigableHighlightTag kind, SnapshotSpan location)> highlights)>
GetHighlightsAsync (SnapshotPoint caretLocation, CancellationToken token)
{
if (!parserProvider.TryGetParser (TextView.TextBuffer, out var parser)) {
Expand Down Expand Up @@ -61,25 +61,25 @@ protected async override
}
return Empty;

(SnapshotSpan sourceSpan, ImmutableArray<(ITextMarkerTag kind, SnapshotSpan location)> highlights)
(SnapshotSpan sourceSpan, ImmutableArray<(NavigableHighlightTag kind, SnapshotSpan location)> highlights)
CreateResult (TextSpan source, TextSpan target)
=> (
new SnapshotSpan (caretLocation.Snapshot, source.Start, source.Length),
ImmutableArray<(ITextMarkerTag kind, SnapshotSpan location)>.Empty
ImmutableArray<(NavigableHighlightTag kind, SnapshotSpan location)>.Empty
.Add ((
MatchingTagHighlightTag.Instance,
new SnapshotSpan (caretLocation.Snapshot, target.Start, target.Length)))
);
}

protected override ITextMarkerTag GetTag (ITextMarkerTag kind) => kind;
protected override NavigableHighlightTag GetTag (NavigableHighlightTag kind) => kind;
}

sealed class MatchingTagHighlightTag : TextMarkerTag
sealed class MatchingTagHighlightTag : NavigableHighlightTag
{
internal const string TagId = "brace matching";

public static readonly MatchingTagHighlightTag Instance = new MatchingTagHighlightTag ();
public static readonly MatchingTagHighlightTag Instance = new ();

private MatchingTagHighlightTag () : base (TagId) { }
}
Expand Down

0 comments on commit 0669960

Please sign in to comment.