Skip to content

fix LSP highlights wrong argument when using a call as argument #2500#3318

Open
asukaminato0721 wants to merge 1 commit intofacebook:mainfrom
asukaminato0721:2500
Open

fix LSP highlights wrong argument when using a call as argument #2500#3318
asukaminato0721 wants to merge 1 commit intofacebook:mainfrom
asukaminato0721:2500

Conversation

@asukaminato0721
Copy link
Copy Markdown
Contributor

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

@meta-cla meta-cla Bot added the cla signed label May 6, 2026
@github-actions github-actions Bot added the size/m label May 6, 2026
@asukaminato0721 asukaminato0721 marked this pull request as ready for review May 6, 2026 14:51
Copilot AI review requested due to automatic review settings May 6, 2026 14:51
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

@github-actions

This comment has been minimized.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LSP highlights wrong argument when using a call as argument

2 participants