microsoft / pylance-release

Documentation and issues for Pylance
Creative Commons Attribution 4.0 International
1.68k stars 771 forks source link

Semantic colorization for quoted type annotations is inconsistent #5810

Open rchiodo opened 2 months ago

rchiodo commented 2 months ago

image

It seems to me that the "Box[T]" should be all one color. The root cause is no semantic value for the [ in the type string.

debonte commented 2 months ago

That matches the behavior of unquoted generic types.

image

rchiodo commented 2 months ago

That seems incorrect to me too :)

debonte commented 2 months ago

I disagree. The type var should be a different color to make it clear that it is a distinct identifier that supports, for example, go to def. I'm indifferent about the bracket coloring.

rchiodo commented 2 months ago

Sorry not the TypeVar, the brackets. Especially in the string. It looks super weird.

debonte commented 2 months ago

I see. The brackets are colored as string characters. I agree, that's weird. I'm not convinced that the brackets should be the same color as the type name though.

rchiodo commented 2 months ago

Putting in triage so we can discuss.

rchiodo commented 2 months ago

Decision was to provide semantic tokens for the brackets. That should make the colors consistent amongst the different ways to show a generic type.

heejaechang commented 2 months ago

currently, according to "Developer: Inspect Editor Tokens and Scopes", all those [] are currently marked as various *.punctuation.* or *.quoted.* tokens/scopes from textmate

so, we can either fix it from semantic tokenizer override textmate token/scopes or we could fix textmate ?