-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[ty] Offer string literal completion suggestions in function calls, annotated assignments, and TypedDict contexts #22154
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
base: main
Are you sure you want to change the base?
Conversation
…nnotated assignments
Diagnostic diff on typing conformance testsNo changes detected when running ty on typing conformance tests ✅ |
|
most of our completions tests are in |
|
(Thanks for the PR! 😃) |
|
Found time to add completions for TypedDict keys as well, so went ahead and added it. I'll leave it alone for review now 😄 |
No particularly good reason, it just seemed like the natural place to put them 😄 Wasn't sure what the scope of the tests in crates/ty_ide/completions.rs was, but was sure I wanted to write e2e tests, so there they went. I tend to prefer e2e tests as I find they capture the important bits of functionality more naturally than typical unit tests do. But I see some of the tests in crates/ty_ide/completions.rs practically do the same thing but with less setup so I can put them in there instead no problem if we prefer. |
|
If there's no specific reason these tests need the full e2e framework, I'd be inclined to put them with most of our other completions tests in |
…e/src/completion.rs
Done |
Summary
This PR adds completion logic to the
tylanguage server to offer string literal completions when the user is typing a string literal in a function call (arg or kwarg), in the rhs of an annotated assignment, or as a key in a TypedDict-compatible object.This functionality addresses two of the items in the
tyCode completion plan.Fixes astral-sh/ty#2189
Test Plan
Four e2e tests have been added to
./crates/ty_server/tests/e2e/completions.rs: