basedpyright
basedpyright copied to clipboard
Missing autocomplete for multi Literal param of function overload
Description
from __future__ import annotations
from functools import wraps
from typing import Any, Callable, Generic, Literal, TypeVar, overload
if __name__ == "__main__":
class Test():
@overload
def sendcmd(self, cmd: Literal["a"]): ...
@overload
def sendcmd(
self, cmd: Literal["b"], x: int = 2
): ...
def sendcmd(
self, cmd, *args, **kwargs
):
pass
Test().sendcmd("a")
And it doesn't select to the specific overload.
This appears on pylance too
i guess since it doesn't know what overload you want, it just picks one for the completions. i agree this isn't ideal and it should just merge the completions from all potentially matching overloads
i guess since it doesn't know what overload you want, it just picks one for the completions. i agree this isn't ideal and it should just merge the completions from all potentially matching overloads
https://github.com/microsoft/pylance-release/issues/4428