pylance-release
pylance-release copied to clipboard
Wrong argument provided during auto completion if inside a collection
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
]
)
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?
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!
looks like signature help's context checking is not checking a case where it is nested another expression.