[ty] Add function parentheses completion#25305
Conversation
3df4dd9 to
e68d358
Compare
Typing conformance resultsNo changes detected ✅Current numbersThe percentage of diagnostics emitted that were expected errors held steady at 91.94%. The percentage of expected errors that received a diagnostic held steady at 87.09%. The number of fully passing files held steady at 92/134. |
Memory usage reportMemory usage unchanged ✅ |
cab4fd8 to
e303636
Compare
|
| Project | Old Time | New Time | Change |
|---|---|---|---|
scipy |
2.02s | 3.09s | +53% |
63906f9 to
13026a7
Compare
lerebear
left a comment
There was a problem hiding this comment.
This looks good to me overall, but I think there is one potential regression that we should attend to before we proceed.
| completion_settings.complete_function_parentheses &= | ||
| client_capabilities.supports_completion_item_snippets(); |
There was a problem hiding this comment.
By contrast, Pyrefly still inserts parens when snippets aren't supported, just without placing the cursor in between the parens. That has its drawbacks (the cursor ends up in an annoying position), but it is potentially less surprising once the user has enabled the complete_function_parentheses setting. Should we perhaps follow suit?
On a related note, do we have enough information to potentially do better than just inserting parens and placing the cursor in between them? For example, are there cases where we understand the signature of the method we're suggesting for completion such that we can add tab stops for each required argument? We needn't do that immediately, but it might be a nice touch for the future.
There was a problem hiding this comment.
On a related note, do we have enough information to potentially do better than just inserting parens and placing the cursor in between them?
I think so and this is also something that I realized that this would be another use case for snippets. I'd have to check if this is already covered by our signature completions. If not, that would be another great extension.
3bbb4b9 to
70bb32a
Compare
70bb32a to
0a557ee
Compare
lerebear
left a comment
There was a problem hiding this comment.
Thanks for the edits; latest looks great ✨
b22948f to
c57c4d3
Compare
|
@MichaReiser thank you and the ty team for hearing my idea! love the feature! |
Summary
Add an opt-in completion setting that inserts parentheses snippets for callable completions.
Closes astral-sh/ty#977
Test Plan
Screen.Recording.2026-05-22.at.12.11.07.mov