-
Notifications
You must be signed in to change notification settings - Fork 771
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
Finding type info for functions can cause huge delays in displaying inline documentation if type hints aren't given #1895
Comments
I would normally close this as a dupe of #946, but you're suggesting the concrete change of only showing the type information once it's available, and to show things like docstrings if we have them faster. The general problem is that there's no way to do this in VS Code or the LSP; it asks for a hover, then waits for the full result, and then that's it. Pylance will cache the info so it's fast the next time, but otherwise, there's no way to update it once we send it back. We could send a limited response and then have a more complete one later, but it would only appear if you exit the hover and come back again. sympy is a really complicated library, so it tends to be slow the first time you interact with it; stubs help. |
I'd say that although it'd be possible to get stubs for libraries, it'd effectively be a game of cat and mouse trying to find or create stubs for any library that happens to have the same issue. I know that I've had issues for some of my own personal projects where certain situations have caused similar lag, so it's not like this issue is isolated to SymPy (even if in my case it was due to bad design :P ). I think a good compromise is to set a time-out (eg 1 second) for the types to load and then just return the information without type hints if it isn't loaded at that point, and then update it on later occasions if necessary, although it could be an idea to actually add the ability to update the hints after they've displayed in VS Code. |
I've checked and Eric's change for #1890 also significantly improves sympy performance. In this case, typing I'm going to mark this one as fixed, but going further to improve the type will definitely take a stub or upstream to annotate their code. |
This issue has been fixed in version 2021.10.0, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/main/CHANGELOG.md#2021100-6-october-2021 |
Environment data
Expected behaviour
While type info is loaded for a function, inline documentation (docstrings) are displayed without the type annotations. If/when type info is determined, the hint is updated to include the information.
Actual behaviour
If type info isn't provided for a function, all inline documentation can take minutes to load as PyLance tries to determine return types for the function.
Logs
Code Snippet / Additional information
Steps to reproduce:
sympy
, and make a call to the functionsympy.solve()
It seems that I'm not the first to notice this issue: #946
I hope this performance issue can be fixed soon!
The text was updated successfully, but these errors were encountered: