Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax highlighting for PEP 695: Type Parameter Syntax #5541

Closed
rchiodo opened this issue Feb 28, 2024 Discussed in #5540 · 9 comments
Closed

Syntax highlighting for PEP 695: Type Parameter Syntax #5541

rchiodo opened this issue Feb 28, 2024 Discussed in #5540 · 9 comments
Assignees
Labels
enhancement New feature or request fixed in next version (main) A fix has been implemented and will appear in an upcoming version

Comments

@rchiodo
Copy link
Contributor

rchiodo commented Feb 28, 2024

Discussed in #5540

Originally posted by einarwar February 28, 2024
I recently started using python 3.12, but to my surprise the syntax highlighting for the new type parameter added in PEP 695 was white! Generally white color is used when accessing attributes/methods on Unknown objects. See image below:

image

Is this color intentional or have i not set up pylance correctly?

@github-actions github-actions bot added the needs repro Issue has not been reproduced yet label Feb 28, 2024
@rchiodo
Copy link
Contributor Author

rchiodo commented Feb 28, 2024

See the discussion, but it looks like we don't return a separate token for this case:

image

@KacieKK KacieKK added enhancement New feature or request and removed needs repro Issue has not been reproduced yet labels Mar 4, 2024
@dangotbanned
Copy link

#4645 (comment)

Since then I've been using this theme, which seems to have resolved the symptom described here.

@agalazis
Copy link

Any updates ? Since we all start adopting python 12 in our projects, it gets frustrating to miss on new features...

@agalazis
Copy link

agalazis commented Sep 14, 2024

As an update, I ended up switching from pylance to based pyright.
https://marketplace.visualstudio.com/items?itemName=detachhead.basedpyright

@heejaechang
Copy link
Contributor

a: MyType also shows MyType as white. we should update our semantic tokenizer to support new TypeAlias at the decl and usage.

@heejaechang
Copy link
Contributor

This issue has been fixed in prerelease version 2025.1.100, which we've just released. You can find the changelog here: CHANGELOG.md

@cdce8p
Copy link

cdce8p commented Jan 16, 2025

This issue has been fixed in prerelease version 2025.1.100, which we've just released.

Awesome to have syntax highlighting for PEP 695 type aliases. However, type parameter are still missing unfortunately.

Image

Example code
from typing import Generic, TypeVar

T = TypeVar("T")

class X(Generic[T]):
    def __init__(self, var: T) -> None: ...


class Y[T]:
    def __init__(self, var: T) -> None: ...

@kamzil
Copy link

kamzil commented Feb 13, 2025

As @cdce8p said, this is still not fully working for generic class type parameters in 2025.2.1.

@debonte
Copy link
Contributor

debonte commented Feb 13, 2025

Awesome to have syntax highlighting for PEP 695 type aliases. However, type parameter are still missing unfortunately.

Thanks for pointing that out. I opened #6942 to track that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fixed in next version (main) A fix has been implemented and will appear in an upcoming version
Projects
None yet
Development

No branches or pull requests

9 participants