jedi icon indicating copy to clipboard operation
jedi copied to clipboard

@typing.overload decorator not supported; only @overload

Open C-SELLERS opened this issue 3 years ago • 1 comments

Using Jedi as Python Language Server for VSCode I have some issues I am seeing with autocomplete from a stubs module that has various overloads.

In the stubs module itself I see the decorators @typing.overload on each of the overloads. The autocomplete feature for Pylance loads all these overloads and shows them to me. For Jedi however, it only shows one implementation.

In testing I changed a few from @typing.overload to @overload and then it worked. I could see all the implementation is autocomplete, even without from typing import overload in the module.

So it seems Jedi, may not recognize the typing namespace as a valid part of the overload decorator. I might assume this applies to other typing decorators as well.

C-SELLERS avatar Feb 24 '22 02:02 C-SELLERS

The bug only affects overload, because for performance reasons we do not fully infer here.

If you want to fix it, it's probably not that hard, just check jedi/inference/value/function.py _find_overload_functions and play with that function a bit.

davidhalter avatar Feb 26 '22 14:02 davidhalter