You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The semantic tokens file view provider is unsure whether a keyword token is an identifier #2346
The semantic tokens file view provider can't tell whether a token of the standard type keyword is an identifier, or a type. It answers "unsure" for both.
What happens
LSPSemanticToken classifies a token through a few sets of token types:
ALL_TOKEN_TYPES lists the standard types and LSP4IJ's custom ones, but not keyword.
KEYWORD_TOKEN_TYPES has keyword and modifier.
NON_IDENTIFIER_TOKEN_TYPES and NON_TYPE_TOKEN_TYPES are ALL_TOKEN_TYPES minus the identifier and type sets.
So isIdentifier() and isType() of a keyword token are UNSURE. For modifier, which is in ALL_TOKEN_TYPES, both are NO.
Effect
From reading the code, not checked live: LSPSemanticTokenDocumentationProvider asks the language server for a token's hover documentation only when the token is an identifier, or is surely not one and isn't whitespace. So Quick Documentation on a keyword, in a file of the semantic tokens file view provider (a TextMate or plain-text file), doesn't ask the language server. rust-analyzer, for one, documents its keywords.
How it was found
The test of #2338 that checks that a custom token type is classified as its super type, LSPSemanticTokenCustomTypesTest, has to skip the answers that keyword leaves unsure.
Fix
Add SemanticTokenTypes.Keyword to ALL_TOKEN_TYPES, with a test of the classification and of the documentation of a keyword.
Activity
fix: the semantic tokens file view provider knows that a keyword toke…