Skip to content

Support specifying language for semantic token types and modifiers #103097

@0dinD

Description

@0dinD

Issue Type: Feature Request

Currently, only the semanticTokenScopes contribution point supports language-specific contributions for semantic tokens, via the "language": "..." property. But the semanticTokenTypes and semanticTokenModifiers contribution points do not support specifying the language, which means that semantic token types and modifiers are declared globally, for all languages. This causes a problem where the token contribution of one extension might override the token contribution of the same ID, from another extension (or even from the default tokens).

Implementing this feature would yield the following benefit:

Extensions providing semantic tokens could declare supertypes for new and existing token types, without breaking semantic highlighting for other languages that want to declare a different supertype for the same token type. For example, Java methods, which get the token type function in the redhat.java extension, should have the token supertype of member since that holds true for all methods in Java. But in other languages, such as TypeScript, functions are not always members. If the redhat.java extension were to declare member the supertype of function, this would cause the same behavior in TypeScript, which is undesirable. Instead, the redhat.java extension should be able to declare that functions are members, but only for tokens provided to Java files. Another "collision" that could happen in the future is that annotations are types in Java, but they are functions in TypeScript.

VS Code version: Code 1.47.2 (17299e4, 2020-07-15T18:22:15.161Z)
OS version: Linux x64 4.19.0-9-amd64

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions