Open xiaoxi-david opened 2 years ago
Similarly, consider behavior of NewType
-- https://github.com/microsoft/pylance-release/issues/3754
Any updates on this?
Sorry but this is not currently planned. However you can get this somewhat by yourself.
The TypeAlias is flagged with a typehint
modifier in the semantic token. This allows you to override the color:
"editor.semanticTokenColorCustomizations": {
"[Default Dark Modern]": {
"rules": {
"*.typeHint": "#4EC9B0"
}
}
}
Which for me, gives the same color for the typehint as the original type.
Great, I'll try for it. Thanks!
It works for type hints only, so I think pylance should still provide separate semantic tokes for type aliases (or mark them as types or classes at least).
Anyway, the type hint trick is better than nothing, thanks for the suggestion.
Really need this feature!
I wonder if:
Pylance could use
TypeAlias
instead of the type alias name for the type hinting for type aliases. According to PEP 613, the type hinting for type aliases should be TypeAlias.Pylance could use the same color to display type hintings regardless of whether they are native or type aliases. When I use the theme Horizon Extended Theme, native type hintings are in yellow and type aliases in red (like variables).
Example:
I am using: