Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docstring and prototype not properly shown with pylance #109

Open
vxgmichel opened this issue May 8, 2024 · 1 comment
Open

Docstring and prototype not properly shown with pylance #109

vxgmichel opened this issue May 8, 2024 · 1 comment

Comments

@vxgmichel
Copy link
Owner

vxgmichel commented May 8, 2024

Pylance does not show the actual docstring and prototype when overing a stream operators:
stream

Surprisingly, it does show it for their pipe method:
pipe

Also, it does show when opening a parenthesis after a stream operator:
stream2

Note that introspection does work properly:

$ ipython
In [1]: from aiostream import stream
In [2]: stream.take?
Signature:      stream.take(source: 'AsyncIterable[T]', n: 'int') -> 'Stream[T]'
Type:           PipableOperatorImplementation
String form:    aiostream.stream.select.take
File:           ~/repos/aiostream/aiostream/stream/select.py
Docstring:     
Forward the first ``n`` elements from an asynchronous sequence.

If ``n`` is negative, it simply terminates before iterating the source.

@vxgmichel
Copy link
Owner Author

Interestingly, that issue has been addressed on the pylance tracker last week:
microsoft/pylance-release#5840 (comment)

In summary, I think the pyright type analyzer is doing the right thing here and preserving the docstring, but the hover provider (which is owned by the pylance team) is not using this information when the identifier is an instance of a callable object (i.e. an instance of a class that has a __call__ method). So I think this is a feature request for the Pylance team to add such support.

It seems like this will be fixed in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant