[ty] IDE: only provide declarations and bindings as completions#18456
Merged
[ty] IDE: only provide declarations and bindings as completions#18456
Conversation
sharkdp
commented
Jun 4, 2025
| assert_snapshot!(test.completions(), @r" | ||
| Fo | ||
| float | ||
| "); |
Contributor
Author
There was a problem hiding this comment.
float will be available again once we add all builtins as a source for completions.
Contributor
|
AlexWaygood
approved these changes
Jun 4, 2025
AlexWaygood
reviewed
Jun 4, 2025
24dd681 to
823a556
Compare
carljm
added a commit
to mtshiba/ruff
that referenced
this pull request
Jun 4, 2025
* main: [ty] Only consider a type `T` a subtype of a protocol `P` if all of `P`'s members are fully bound on `T` (astral-sh#18466) [ty] Exclude members starting with `_abc_` from a protocol interface (astral-sh#18467) [ty] Add subdiagnostic suggestion to `unresolved-reference` diagnostic when variable exists on `self` (astral-sh#18444) [ty] IDE: only provide declarations and bindings as completions (astral-sh#18456) [ty] ty_ide: Hotfix for `expression_scope_id` panics (astral-sh#18455) [ty] Improve docs for Class{Literal,Type}::instance_member (astral-sh#18454) [ty] Add meta-type tests for legavy TypeVars (astral-sh#18453) update to salsa that doesn't panic silently on cycles (astral-sh#18450)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Previously, all symbols where provided as possible completions. In an example like the following, both
fooandfwere suggested as completions, becausefitself is a symbol.Similarly, in the following example,
hidden_symbolwas suggested, even though it is not statically visible:With the change suggested here, we only use statically visible declarations and bindings as a source for completions. In the scenario from this comment, we do not include
ReadableBufferanymore (which is available as a symbol, but not re-exported fromtyping). A test for this was also added here.Test Plan