SemanticTokenTypes.type is ambigious
See original GitHub issueI think type
might mean either of these three different things:
- type alias, like
type Foo = ();
ortypedef int uint32_t;
- type reference, like
let x: (i32, i32) = (0, 0)
orint x = 92;
- type as a modifier: structs, interfaces, enums are “types”
I suggest renaming it to typeAlias / typedef
, as that is much more specific, and probably the most useful one.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
metaphysics - Why do we have type-token ambiguity?
1 Answer 1 ... "Why do we struggle to separate the idea of a type from a token?" Well, in ordinary language, there...
Read more >Proper way to handle ambiguous tokens in PLY - Stack Overflow
Is there any need for the tokenizer to distinguish between variables, numbers, field references and tag references?
Read more >Some Types of Ambiguous Tokens - JSTOR
SOME TYPES OF AMBIGUOUS TOKENS'. By J. A. FODOR and R. B. FREED ... and J. A. Fodor, " The Structure of a...
Read more >Semantic Highlight Guide | Visual Studio Code Extension API
Each token returned by the provider comes with a classification that consists of a token type, any number of token modifiers, and a...
Read more >Type–token distinction - Wikipedia
The type–token distinction is the difference between naming a class (type) of objects and naming the individual instances (tokens) of that class.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
type
is intended to be the super type of all types. In VSCode we maptype
to TextMate scopeentity.name.type
We can also addtypeAlias
, if there are multiple languages can use it. But that said, language servers are free to come up with their own custom token types. The plan is to introduce a naming convention for custom token types such astype>typeAlias
to signal thattypeAlias
is extendingtype
.There are documented here https://github.com/microsoft/vscode-languageserver-node/blob/master/protocol/src/common/protocol.semanticTokens.ts#L18 and in the 3.16.0 spec. I will add something for the type value.