fix LSP highlights wrong argument when using a call as argument #2500#3318
Open
asukaminato0721 wants to merge 1 commit intofacebook:mainfrom
Open
fix LSP highlights wrong argument when using a call as argument #2500#3318asukaminato0721 wants to merge 1 commit intofacebook:mainfrom
asukaminato0721 wants to merge 1 commit intofacebook:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes LSP signature help’s active-argument inference by counting only top-level argument separators (commas), ignoring commas that occur inside nested calls/containers, strings, and comments—addressing Issue #2500 where nested commas caused the wrong parameter to be highlighted.
Changes:
- Replace naive comma counting with a lightweight depth-aware scanner that skips Python string literals and line comments.
- Add regression tests covering nested calls, tuple literals, and commas inside strings.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
pyrefly/lib/lsp/wasm/signature_help.rs |
Updates active-argument inference to count only top-level commas, skipping nested delimiters, strings, and comments. |
pyrefly/lib/test/lsp/signature_help.rs |
Adds a test ensuring nested commas don’t affect active_parameter selection. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This comment has been minimized.
This comment has been minimized.
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
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
Fixes #2500
active-argument inference counts only top-level argument separators, ignoring commas inside nested calls, tuples/lists/braces, strings, and comments.
Test Plan
add test