pylance-release icon indicating copy to clipboard operation
pylance-release copied to clipboard

Wrong argument provided during auto completion if inside a collection

Open Viicos opened this issue 1 year ago • 2 comments

Note: if you are reporting a wrong signature of a function or a class in the standard library, then the typeshed tracker is better suited for this report: https://github.com/python/typeshed/issues.

If you have a question about typing or a behavior that you’re seeing in Pyright (as opposed to a bug report or enhancement request), consider posting to the Pyright discussion forum.

Describe the bug

When requesting auto completions in the code snippet below, pyright (or Pylance?) will display the commands= argument, which is not valid as we are still in the list of the range argument.

Code or Screenshots

Code sample in pyright playground

class Model:
    def __init__(self, ranges: list[str], commands: list[str]) -> None: ...



m = Model(
    ranges=[
        "a",
        # Request auto completion with the cursor at this position
    ]
)

image

VS Code extension or command-line Are you running pyright as a VS Code extension, a language server in another editor, integrated into Pylance, or the command-line tool? Which version?

Viicos avatar Jun 26 '24 08:06 Viicos

Since this is a language server issue, I'll leave it to the pylance team to investigate.

@rchiodo, @debonte, could one of you please transfer this to pylance-release? Thanks!

erictraut avatar Jun 26 '24 19:06 erictraut

looks like signature help's context checking is not checking a case where it is nested another expression.

heejaechang avatar Jun 28 '24 17:06 heejaechang