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

Wrong docstring shown for nn.LayerNorm.__init__ #1753

Closed
jingw222 opened this issue Sep 2, 2021 · 6 comments
Closed

Wrong docstring shown for nn.LayerNorm.__init__ #1753

jingw222 opened this issue Sep 2, 2021 · 6 comments
Assignees
Labels
bug Something isn't working docstrings needs investigation Could be an issue - needs investigation

Comments

@jingw222
Copy link

jingw222 commented Sep 2, 2021

What we have:
Screen Shot 2021-09-02 at 12 36 05 AM
which only shows a very terse signature. How do we get the full docstrings:
Screen Shot 2021-09-02 at 12 40 38 AM
as in Jupyter:

Screen.Recording.2021-09-02.at.12.46.37.AM.mov
@karthiknadig
Copy link
Member

@jingw222 Are you using pylance or jediLSP as the language server?

@karthiknadig karthiknadig self-assigned this Sep 2, 2021
@jingw222
Copy link
Author

jingw222 commented Sep 2, 2021

@jingw222 Are you using pylance or jediLSP as the language server?

Thanks for asking. I'm using the latest pylance.

Version: 1.59.1
Commit: 3866c3553be8b268c8a7f8c0482c0c0177aa8bfa
Date: 2021-08-19T11:53:52.479Z
Electron: 13.1.7
Chrome: 91.0.4472.124
Node.js: 14.16.0
V8: 9.1.269.36-electron.0
OS: Darwin x64 20.6.0

@karthiknadig karthiknadig transferred this issue from microsoft/vscode-python Sep 2, 2021
@github-actions github-actions bot added the triage label Sep 2, 2021
@jakebailey
Copy link
Member

jakebailey commented Sep 2, 2021

What project is this, pytorch? Yes, pytorch; should have looked at the screencast.

That doc is likely Module's docs; we have a bug at the moment where we return the parent class' __init__ doc before we offer up the class's docs itself. You can confirm this by hovering over LayerNorm without calling it, or hovering over the class name at its declaration.

@jakebailey jakebailey changed the title Show complete docstring on hover Wrong docstring shown for nn.LayerNorm.__init__ Sep 2, 2021
@jakebailey jakebailey added bug Something isn't working docstrings in backlog needs investigation Could be an issue - needs investigation and removed triage labels Sep 2, 2021
@jakebailey jakebailey self-assigned this Sep 2, 2021
@jakebailey
Copy link
Member

I'm going to close this in favor of #1047, which is the same issue (and I've retitled it to better represent the problem).

@jingw222
Copy link
Author

jingw222 commented Sep 9, 2021

This issue has been announced as fixed in the Pylance v2021.9.1 release as you said in the linked issue. But The hover box still shows me what it was before. What gives?

@jakebailey
Copy link
Member

Later in that issue, we decided that this particular behavior wasn't a necessarily a bug; it's unclear whether or not the parent class's init doc is the more useful one if the class doc also exists. Other editors appear to behave similarly to us, except that we show the init doc when invoking a class (which calls init).

The other issue was in fact actually fixed (as it involved a doc from object), but this particular issue is entirely between non-builtin classes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working docstrings needs investigation Could be an issue - needs investigation
Projects
None yet
Development

No branches or pull requests

3 participants