-
Notifications
You must be signed in to change notification settings - Fork 675
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
Adjusts csharp semantic token scopes to match 1.26 outputs #6094
Adjusts csharp semantic token scopes to match 1.26 outputs #6094
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
I believe the tests are failing for an unrelated reason and I'm unable to restart the pipeline due to lack of access if someone could retry them for me? |
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.
Thanks for the contribution - one suggestion to try out.
package.json
Outdated
@@ -4737,40 +4737,40 @@ | |||
"language": "csharp", | |||
"scopes": { | |||
"namespace": [ | |||
"entity.name.type.namespace.cs" | |||
"entity.name.namespace" |
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.
So looking at the 1.x version, it doesn't specify any fallback textmate scopes for semantic tokens. Which I believe means that it uses the default fallbacks as defined here - https://code.visualstudio.com/api/language-extensions/semantic-highlight-guide#predefined-textmate-scope-mappings .
I think removing the fallbacks for the core LSP semantic token names (aka anything in that table) would have the same affect (as suggested by Joey here - #5731 (comment)). Would you be able to try that? If it works I think that is the direction we should take.
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.
Makes sense, thank you, I've made the change and it looks good!
It's also resolved a 1.x issue I had noticed where local variables had the .cs namespace so looked incorrect in some themes.
So trying it out locally - it definitely doesn't look right (mainly keywords I think?) on Visual Studio 2019 Dark What the colors should look like: It looks like its getting the cc @JoeRobich in case he knows of another idea |
"struct": [ | ||
"entity.name.type.struct.cs" | ||
], | ||
"typeParameter": [ |
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.
`typeParameter doesn't list a fallback in the table, we probably need to keep this one
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.
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.
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.
I think we should set it to "entity.name.type.type-parameter" in the scopes
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.
This one is interesting, in 1.x it maps as entity.name.type.parameter
Interesting - I don't know where that is coming from.
I think we should set it to "entity.name.type.type-parameter" in the scopes
Yup, I'm good with that. If though entity.name.type.parameter
looks better on other themes, and it works with the VS theme, I'm also OK with setting to that. But entity.name.type.type-parameter
seems to be what O# used.
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.
I checked this one on a couple of themes and it looks ok to me.
"macro": [ | ||
"keyword.preprocessor.cs" | ||
], | ||
"keyword": [ |
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.
same with keyword here.
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.
If keyword.cs
doesn't work on the other themes - try just 'keyword'. It looks like it should have the correct color in the theme json
https://github.com/dotnet/vscode-csharp/blob/main/themes/vs2019_dark.json#L311
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.
Okay, thank you, I will update and will double check them one by one and compare the outputs.
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.
Added this back in, looks ok now, please see my latest comment with comparisons.
Updated with changes and compared each token that was removed against v 1.26.0: A couple of small discrepancies to mention:
|
I'm OK with this change, it looks to be the same in the new version with or without this change. If we get a ton more feedback we can always switch it later.
Yup works for me. Thanks for the contribution! |
Happy to help, and thank you! |
Blame VS Code for that. No idea why they only included one core keyword token type and choose the |
This PR adjusts the semantic token scopes to match those in earlier versions, 1.26 etc.
Directly relates to Issue #5731
I've compared the foreground outputs using the Inspect Editor Tokens in version 1.26.0 and in this version an confirmed the primary foreground now matches for all of the updated scopes in this PR.
For example the two listed in the original issue:
Namespace in 1.26.0:
Namespace in latest:
Parameter in 1.26.0:
Parameter in latest: