-
Notifications
You must be signed in to change notification settings - Fork 676
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 Razor C# semantic tokens support in VS Code #6489
Changes from all commits
0eb887a
4372123
7d10a43
c515255
7091f5d
7f6d7be
5b684b7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5175,6 +5175,168 @@ | |
"markupCommentPunctuation": [ | ||
"punctuation.definition.comment.html", | ||
"comment.block.html" | ||
], | ||
"keyword": [ | ||
"keyword.cs" | ||
], | ||
"excludedCode": [ | ||
"support.other.excluded.cs" | ||
], | ||
"controlKeyword": [ | ||
"keyword.control.cs" | ||
], | ||
"operatorOverloaded": [ | ||
"entity.name.function.member.overload.cs" | ||
], | ||
"preprocessorText": [ | ||
"meta.preprocessor.string.cs" | ||
], | ||
"punctuation": [ | ||
"punctuation.cs" | ||
], | ||
"stringVerbatim": [ | ||
"string.verbatim.cs" | ||
], | ||
"stringEscapeCharacter": [ | ||
"constant.character.escape.cs" | ||
], | ||
"delegate": [ | ||
"entity.name.type.delegate.cs" | ||
], | ||
"module": [ | ||
"entity.name.type.module.cs" | ||
], | ||
"field": [ | ||
"entity.name.variable.field.cs" | ||
], | ||
"constant": [ | ||
"variable.other.constant" | ||
], | ||
"extensionMethod": [ | ||
"entity.name.function.extension.cs" | ||
], | ||
"xmlDocCommentAttributeName": [ | ||
"comment.documentation.attribute.name.cs" | ||
], | ||
"xmlDocCommentAttributeQuotes": [ | ||
"comment.documentation.attribute.quotes.cs" | ||
], | ||
"xmlDocCommentAttributeValue": [ | ||
"comment.documentation.attribute.value.cs" | ||
], | ||
"xmlDocCommentCDataSection": [ | ||
"comment.documentation.cdata.cs" | ||
], | ||
"xmlDocCommentComment": [ | ||
"comment.documentation.comment.cs" | ||
], | ||
"xmlDocCommentDelimiter": [ | ||
"comment.documentation.delimiter.cs" | ||
], | ||
"xmlDocCommentEntityReference": [ | ||
"comment.documentation.entityReference.cs" | ||
], | ||
"xmlDocCommentName": [ | ||
"comment.documentation.name.cs" | ||
], | ||
"xmlDocCommentProcessingInstruction": [ | ||
"comment.documentation.processingInstruction.cs" | ||
], | ||
"xmlDocCommentText": [ | ||
"comment.documentation.cs" | ||
], | ||
"xmlLiteralAttributeName": [ | ||
"entity.other.attribute-name.localname.xml" | ||
], | ||
"xmlLiteralAttributeQuotes": [ | ||
"string.quoted.double.xml" | ||
], | ||
"xmlLiteralAttributeValue": [ | ||
"meta.tag.xml" | ||
], | ||
"xmlLiteralCDataSection": [ | ||
"string.quoted.double.xml" | ||
], | ||
"xmlLiteralComment": [ | ||
"comment.block.xml" | ||
], | ||
"xmlLiteralDelimiter": [ | ||
"text.xml" | ||
], | ||
"xmlLiteralEmbeddedExpression": [ | ||
"meta.tag.xml" | ||
], | ||
"xmlLiteralEntityReference": [ | ||
"meta.tag.xml" | ||
], | ||
"xmlLiteralName": [ | ||
"entity.name.tag.localname.xml" | ||
], | ||
"xmlLiteralProcessingInstruction": [ | ||
"meta.tag.xml" | ||
], | ||
"xmlLiteralText": [ | ||
"text.xml" | ||
], | ||
"regexComment": [ | ||
"string.regexp.comment.cs" | ||
], | ||
"regexCharacterClass": [ | ||
"constant.character.character-class.regexp.cs" | ||
], | ||
"regexAnchor": [ | ||
"keyword.control.anchor.regexp.cs" | ||
], | ||
"regexQuantifier": [ | ||
"keyword.operator.quantifier.regexp.cs" | ||
], | ||
"regexGrouping": [ | ||
"punctuation.definition.group.regexp.cs" | ||
], | ||
"regexAlternation": [ | ||
"keyword.operator.or.regexp.cs" | ||
], | ||
"regexText": [ | ||
"string.regexp" | ||
], | ||
"regexSelfEscapedCharacter": [ | ||
"string.regexp.self-escaped-character.cs" | ||
], | ||
"regexOtherEscape": [ | ||
"string.regexp.other-escape.cs" | ||
], | ||
"jsonComment": [ | ||
"comment.line.double-slash.js" | ||
], | ||
"jsonNumber": [ | ||
"constant.numeric.json" | ||
], | ||
"jsonString": [ | ||
"string.quoted.double.json" | ||
], | ||
"jsonKeyword": [ | ||
"constant.language.json" | ||
], | ||
"jsonText": [ | ||
"string.quoted.double.json" | ||
], | ||
"jsonOperator": [ | ||
"string.quoted.double.json" | ||
], | ||
"jsonPunctuation": [ | ||
"punctuation.separator.dictionary.key-value.json" | ||
], | ||
"jsonArray": [ | ||
"punctuation.definition.array.begin.json" | ||
], | ||
"jsonObject": [ | ||
"punctuation.definition.dictionary.begin.json" | ||
], | ||
"jsonPropertyName": [ | ||
"support.type.property-name.json" | ||
], | ||
"jsonConstructorName": [ | ||
"support.type.property-name.json" | ||
] | ||
} | ||
}, | ||
|
@@ -5369,7 +5531,12 @@ | |
{ | ||
"language": "aspnetcorerazor", | ||
"scopeName": "text.aspnetcorerazor", | ||
"path": "./src/razor/syntaxes/aspnetcorerazor.tmLanguage.json" | ||
"path": "./src/razor/syntaxes/aspnetcorerazor.tmLanguage.json", | ||
"unbalancedBracketScopes": [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if this is the only one - you might want to test less than / greather than as well There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah you're right, and I was missing bit shifting operators as well. Thanks! |
||
"keyword.operator.arrow.cs", | ||
"keyword.operator.bitwise.shift.cs", | ||
"keyword.operator.relational.cs" | ||
] | ||
} | ||
], | ||
"menus": { | ||
|
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 needed to override the default colors VS Code uses since they can differ compared to what C# uses. For example,
keyword
is colored purple by VS Code, but colored blue by C#.Thanks @dibarbet for the tip!
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.
Interesting, so "keyword.cs" is already blue for VS Code and it just... knows?
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'm guessing C# sets the color somewhere, although I'm not sure where. Maybe @dibarbet or @JoeRobich would know?
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 don't quite remember - it was potentially that the lsp token type for
keyword
mapped tokeyword.control
butkeyword.cs
falls back tokeyword
insteadThere 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.
POssibly https://github.com/microsoft/vscode/blob/b96b558f6479557a43de966d7cfdbcdffb82d715/src/vs/platform/theme/common/tokenClassificationRegistry.ts#L545