-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a test for keyword highlighting #18430
Conversation
{ | ||
} | ||
|
||
[Fact, Trait(Traits.Feature, Traits.Features.Classification)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Traits.Features.KeywordHighlighting
?
} | ||
}"); | ||
|
||
Verify("foreach", 3); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VerifyHighlightCount
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests are strange. I'd expect something with markup indicating which spans are highlighted and checking that.
|
||
Verify("To", 3); | ||
VisualStudio.ExecuteCommand("Edit.NextHighlightedReference"); | ||
Assert.Equal(VisualStudio.Editor.GetCaretPosition(), 112); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use SetUpEditor and then get the position from the $$ in that markup? I really dislike these large numbers that represent positions in code.
Assert.Equal(VisualStudio.Editor.GetCaretPosition(), 112); | ||
} | ||
|
||
private void Verify(string marker, int expectedCount) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate code.
@@ -0,0 +1,254 @@ | |||
<?xml version="1.0" encoding="utf-8"?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uhh. This needs to be deleted.
@@ -147,6 +142,9 @@ public bool IsSignatureHelpActive() | |||
public string[] GetErrorTags() | |||
=> GetTags<IErrorTag>(); | |||
|
|||
public int GetHighlightTagCount() | |||
=> GetTags<ITextMarkerTag>(tag => tag.Type == KeywordHighlightTag.TagId).Length; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just return the tag spans themselves and check them?
Tag @dotnet/roslyn-ide for review