[
and ]
should have a modifier of typeHint when used in type hints
#2680
Replies: 5 comments
-
We don't emit semantic tokens for any tokens like this (only names, builtin constants Reading the LSP spec for semantic tokens, I'm not entirely certain there's a token that we can use for these, though: https://microsoft.github.io/language-server-protocol/specification#textDocument_semanticTokens We'd have to compare to something like TS with its |
Beta Was this translation helpful? Give feedback.
-
From my perspective, I think this can be an option(not as default), because when a type hint is complicated(like |
Beta Was this translation helpful? Give feedback.
-
agreed, ideally they could be colored as their own entity like |
Beta Was this translation helpful? Give feedback.
-
implementation wise, we will need to go through tokens to support this since for now, we only process parse tree and name node. |
Beta Was this translation helpful? Give feedback.
-
Moving this issue to discussion as an enhancement request for comments and upvotes. |
Beta Was this translation helpful? Give feedback.
-
Environment data
Name: Pylance
Id: ms-python.vscode-pylance
Description: A performant, feature-rich language server for Python in VS Code
Version: 2021.10.2-pre.1
Publisher: Microsoft
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance
Expected behaviour
Semantic coloring should be consistent in the type hint, but the item access
[
and]
don't get thetypeHint
modifierActual behaviour
The item accessors
[
and]
don't get thetypeHint
modifier in a type hintCode Snippet / Additional information
in this screenshot i'd expect the

[
and]
to be red like the rest of the type hits.Beta Was this translation helpful? Give feedback.
All reactions