Skip to content
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

[LSP] Add JSON semantic token classifications #61231

Merged
merged 8 commits into from
May 17, 2022
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,19 @@ internal class SemanticTokensHelpers
ClassificationTypeNames.ExtensionMethodName,
ClassificationTypeNames.FieldName,
ClassificationTypeNames.InterfaceName,

ClassificationTypeNames.JsonArray,
ClassificationTypeNames.JsonComment,
ClassificationTypeNames.JsonConstructorName,
ClassificationTypeNames.JsonKeyword,
ClassificationTypeNames.JsonNumber,
ClassificationTypeNames.JsonObject,
ClassificationTypeNames.JsonOperator,
ClassificationTypeNames.JsonPropertyName,
ClassificationTypeNames.JsonPunctuation,
ClassificationTypeNames.JsonString,
ClassificationTypeNames.JsonText,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of needing to do this manually, can we use reflection to grab all the data we need out of classificationtypenames?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think reflection would be cleaner but would complicate things. Razor expects an exact ordering from Roslyn in terms of classifications, so anytime Roslyn updates classifications we need to manually update Razor as well. I think we could eventually do this if we expose RoslynCustomTokenTypes via external access, but I think this work would best be done in a follow-up PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filed #61237


ClassificationTypeNames.LabelName,
ClassificationTypeNames.LocalName,
ClassificationTypeNames.MethodName,
Expand Down