Fix signature help ranges to prevent display after closing parentheses #1420
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.
Signature help was incorrectly being shown for positions after closing parentheses and in whitespace following function calls. For example:
Previously, both
afterCallandafterNewlinepositions would incorrectly show signature help for thefoomethod when they should show none.Root Cause
The issue was in
getContainingArgumentInfowhich was finding argument information forKindCloseParenTokennodes even when the cursor position was at or after the end of the closing parenthesis. This caused signature help to be displayed in positions where it shouldn't appear.Solution
Added logic to skip
KindCloseParenTokennodes when the position is at or after their end position:Testing
TestSignatureHelpRangeIssuethat validates signature help is shown inside calls but not after closing parenthesesrunSignatureHelpTestWithNiltest helper to validate cases where signature help should NOT be providedTestSignatureHelpNestedCallPrecedenceto document a related issue with nested call precedence (to be addressed separately)Impact
This fix improves the user experience by ensuring signature help only appears in appropriate contexts within function calls, eliminating the confusing behavior where signature help would persist after completing a function call.
Addressing #1419.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.