Skip to content
This repository has been archived by the owner on Apr 14, 2022. It is now read-only.

Intellisense messes with docstrings when function is decorated via typing.overload #1856

Open
arquolo opened this issue Dec 28, 2019 · 1 comment
Labels
enhancement New feature or request feature: analysis

Comments

@arquolo
Copy link

arquolo commented Dec 28, 2019

In this snippet:

from typing import overload

@overload
def foo(x: int) -> int: ...

@overload
def foo(x: str) -> str: ...

def foo(x):
    """Return identity"""
    return x

f = foo(5)

Intellisense should show docs for foo, but it doesn't.
Though, everything works when all overloads are moved to *.pyi.
Tested on:

  • Python: 3.7.5-conda
  • Python Language Server: 0.5.10.0
  • VSCode: 1.42.0-insider
@MikhailArkhipov
Copy link

typing is not actually imported but rather specialized in code so overload is not doing anything. When you move it to a stub, then it is properly handled as a multiple overloads since LS has that capability. Related #535.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request feature: analysis
Projects
None yet
Development

No branches or pull requests

2 participants