-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[ty] Add ty.inlayHints.variableTypes server option
#19780
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
Conversation
Diagnostic diff on typing conformance testsNo changes detected when running ty on typing conformance tests ✅ |
|
125dcaa to
2b934cd
Compare
bf11983 to
20af384
Compare
|
One thing that I've noticed with other server is that they start off with |
20af384 to
5c8297d
Compare
5c8297d to
12d2847
Compare
ty.inlayHints.variablesTypes server optionty.inlayHints.variableTypes server option
| if !self.settings.variable_types { | ||
| return; | ||
| } |
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.
It seems unnecessary to traverse the entire tree only to bail out at the assignment level. Should we add a InlayHintSettings::any_enabled and bail out in the inlay hint request if it returns false to avoid doing all this unnecessary work?
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.
Yeah, that makes sense.
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.
Actually, I don't think we should add that today because there will be (in the future) multiple positions for which we won't provide a way to disable. I don't think the server should provide configuring every position of inlay hints. So, I'm going to avoid adding this today.
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.
Can you give an example of inlays that the user can't disable and we'd always provide (I'm not disagreeing, just curious)?
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.
Actually, I don't have an example on top of my mind and it might be that it doesn't exists 😅
## Summary This PR adds the `ty.inlayHints.variableTypes` as added in the server in astral-sh/ruff#19780. ## Test Plan https://github.com/user-attachments/assets/2ef2fc4e-cbad-4a83-acab-6950bdb0d806
## Summary This PR adds reference documentation for the two new editor settings that were added in astral-sh/ruff#19800 and astral-sh/ruff#19780. ## Test Plan <img width="2491" height="1374" alt="Screenshot 2025-08-07 at 19 24 44" src="https://github.com/user-attachments/assets/f0fc32c5-1045-4fd9-900d-c4e7e429d54f" />
* dcreager/bound-typevar: (24 commits) more comment fix this isn't true anymore fix inner function in overload implementation ecosystem error Update Rust toolchain to 1.89 (#19807) [ty] Add `ty.inlayHints.variableTypes` server option (#19780) synthetic typevars for type materializations are bound [ty] Add failing tests for tuple subclasses (#19803) [ty] Add `ty.experimental.rename` server setting (#19800) clippy make BoundTypeVarInstance interned [ty] Implemented support for "rename" language server feature (#19551) [ty] Reduce size of member table (#19572) [ty] Move server capabilities creation (#19798) separate types! tmp allow KnownInstance::TypeVar in type expressions bind typevar in Generic/Protocol base class reference [ty] Repurpose `FunctionType.into_bound_method_type` to return `BoundMethodType` (#19793) remove unneeded GenericContext::with_binding_context create KnownInstanceType::TypeVar for PEP 695 too ...
## Summary This PR adds reference documentation for the two new editor settings that were added in astral-sh/ruff#19800 and astral-sh/ruff#19780. ## Test Plan <img width="2491" height="1374" alt="Screenshot 2025-08-07 at 19 24 44" src="https://github.com/user-attachments/assets/f0fc32c5-1045-4fd9-900d-c4e7e429d54f" />
Summary
This PR adds a new
ty.inlayHints.variableTypesserver setting to configure ty to include / exclude inlay hints at variable position.Currently, we only support inlay hints at this position so this option basically translates to enabling / disabling inlay hints for now :)
The VS Code extension PR is astral-sh/ty-vscode#112.
closes: astral-sh/ty#472
Test Plan
Add E2E tests.