-
Notifications
You must be signed in to change notification settings - Fork 682
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
Fix some Razor colorization issues #6502
Fix some Razor colorization issues #6502
Conversation
@@ -4813,7 +4813,7 @@ | |||
"description": "A Razor component element" | |||
}, | |||
{ | |||
"id": "razorComponentAttribute", | |||
"id": "RazorComponentAttribute", |
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 is weird, but somehow the Razor language server defines RazorComponentAttribute
as uppercase but all other tokens as lowercase: https://github.com/dotnet/razor/blob/main/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Semantic/Models/RazorSemanticTokensLegend.cs#L31C13-L31C13
We probably want to fix this in the future, although I'm not sure of the implications of making it lowercase/what other things may break
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.
Ah you added this as soon as I hit submit review. IMHO we should modify the server side. It would only break people that have added specific theme customization for this token. But I'm not sure that is super common, and it is easily fixable.
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.
+1 to making a server fix here, unless there's some timeline issues with flowing the bits.
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 changing the casing on the server side breaks VS:
I think this is because we have to make a change to the VS LSP client as well: https://devdiv.visualstudio.com/DevDiv/_git/VSLanguageServerClient?path=/src/product/RemoteLanguage/Impl/Features/SemanticTokens/Tagger/SemanticTokensTaggerBase.cs&version=GBdevelop&line=564&lineEnd=565&lineStartColumn=1&lineEndColumn=1&lineStyle=plain&_a=contents
I'm going to file a follow up issue for this, but since the fix requires multiple repos I think we could still take this as a temporary solution
@@ -4864,6 +4864,10 @@ | |||
"id": "markupAttribute", | |||
"description": "The name of a Markup attribute." | |||
}, | |||
{ | |||
"id": "markupAttributeQuote", |
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.
We were missing this semantic token type
"markupComment": [ | ||
"comment.block.html" | ||
], | ||
"markupCommentPunctuation": [ | ||
"punctuation.definition.comment.html", | ||
"comment.block.html" | ||
], | ||
"markupTagDelimiter": [ |
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.
We defined this token earlier in the file but failed to set a scope for it
@@ -4813,7 +4813,7 @@ | |||
"description": "A Razor component element" | |||
}, | |||
{ | |||
"id": "razorComponentAttribute", | |||
"id": "RazorComponentAttribute", |
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.
why is only this one caps?
@@ -5119,7 +5123,7 @@ | |||
"razorComponentElement": [ | |||
"entity.name.class.element.component" | |||
], | |||
"razorComponentAttribute": [ | |||
"RazorComponentAttribute": [ |
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 here - this feels really inconsistent. Is it possible to make these all uniform
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.
Signing off but would love to see a server fix of "RazorComponentAttribute" to "razorComponentAttribute"
Filed dotnet/razor#9376. The fix is going to involve multi repos and the flow may take a while, so I think we can still take this fix in the meantime |
Partially fixes dotnet/razor#9375 (rest of issue in progress)
Examples of scenarios this PR fixes:
Before:
After (the parens problem is going to require a more complicated fix that I'm actively working on):
Before:
After (same comment as above as parens fix):