-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Semantic tokens: consistently add the DEFINITION modifier
#21521
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
Semantic tokens: consistently add the DEFINITION modifier
#21521
Conversation
Diagnostic diff on typing conformance testsNo changes detected when running ty on typing conformance tests ✅ |
|
MichaReiser
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you
Handling augmented assignments the way you do in this PR seems right to me.
|
Can you run the |
There are a few more statements potentially containing definitions than what is currently covered. This commit reviews all the statements and completes the list of those requiring a custom visitor to add the `DEFINITION` modifier for the appropriate tokens.
af6215a to
9fd6b24
Compare
|
Whoops, sorry. I even ran them, I just overlooked the output 🤦♂️ |
* origin/main: [ty] Fix flaky tests on macos (#21524) [ty] Add tests for generic implicit type aliases (#21522) [ty] Semantic tokens: consistently add the `DEFINITION` modifier (#21521) Only render hyperlinks for terminals known to support them (#21519) [ty] Keep colorizing `mypy_primer` output (#21515) [ty] Exit with `2` if there's any IO error (#21508) [`ruff`] Fix false positive for complex conversion specifiers in `logging-eager-conversion` (`RUF065`) (#21464) [ty] tighten up handling of subscripts in type expressions (#21503)
* origin/main: [ty] Fix flaky tests on macos (#21524) [ty] Add tests for generic implicit type aliases (#21522) [ty] Semantic tokens: consistently add the `DEFINITION` modifier (#21521) Only render hyperlinks for terminals known to support them (#21519) [ty] Keep colorizing `mypy_primer` output (#21515) [ty] Exit with `2` if there's any IO error (#21508) [`ruff`] Fix false positive for complex conversion specifiers in `logging-eager-conversion` (`RUF065`) (#21464) [ty] tighten up handling of subscripts in type expressions (#21503)
Summary
When computing semantic tokens, there are a few more statements potentially containing definitions than what is currently covered.
This commit reviews all the statements and completes the list of those requiring a custom visitor to add the
DEFINITIONmodifier for the appropriate tokens.Note: I've not added the
DEFINITIONmodifier to the target of an augmented assignment. A new test makes that explicit. This is consistent with Pylance's behavior, although one could argue that given that all "regular" assignments are marked as definitions, perhaps also the augmented assignments should.Test Plan
Added new tests for each new statement with a custom visitor. When a test was already existing, I've reviewed and applied the diff.