Skip to content

Conversation

@UnboundVariable
Copy link
Collaborator

This PR fixes bug #879 where the signature help popup remains visible after typing the closing paren in a call expression.

@github-actions
Copy link
Contributor

mypy_primer results

No ecosystem changes detected ✅
No memory usage changes detected ✅

@UnboundVariable UnboundVariable merged commit c8c80e0 into astral-sh:main Jul 24, 2025
37 checks passed
@UnboundVariable UnboundVariable deleted the sig_help_bug branch July 24, 2025 23:26
Copy link
Contributor

@carljm carljm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Comment on lines 68 to +71

if offset >= call_expr.end() {
return None;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the doc comment on get_call_expr, it seems like a violation of its contract (aka a bug) for it to return a call expression that ends before offset. So wouldn't it be slighly better to handle this inside get_call_expr?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you're correct. This fix wasn't sound. I've introduced a better fix — along with some tests to cover this case — in a new PR. The problem is that the old code was using a zero-length range when calling covering_node, and this returned the node to the left of the cursor position.

@dhruvmanila
Copy link
Member

I don't think this is an issue but just wanted to point it out.

Wouldn't this lead to signature help disappearing for nested calls? For example, in the foo call in the video, once I type the foo(bar()<CURSOR>) the signature help disappears and would appear only with the , (trigger character). But, the behavior is different for the baz call where the window stays.

Screen.Recording.2025-07-25.at.09.47.57.mov

AlexWaygood pushed a commit that referenced this pull request Jul 25, 2025
This PR fixes bug [#879](astral-sh/ty#879)
where the signature help popup remains visible after typing the closing
paren in a call expression.

Co-authored-by: UnboundVariable <unbound@gmail.com>
@UnboundVariable
Copy link
Collaborator Author

@dhruvmanila, yes, you're correct. This fix wasn't sound. I've introduced a better fix — along with some tests to cover this case — in a new PR.

UnboundVariable added a commit that referenced this pull request Jul 28, 2025
This PR improves the "signature help" language server feature in two
ways:
1. It adds support for the recently-introduced "stub mapper" which maps
symbol declarations within stubs to their implementation counterparts.
This allows the signature help to display docstrings from the original
implementation.
2. It incorporates a more robust fix to a bug that was addressed in a
[previous PR](#19542). It also
adds more comprehensive tests to cover this case.

Co-authored-by: UnboundVariable <unbound@gmail.com>
@ntBre ntBre added the ty Multi-file analysis & type inference label Jul 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants