Incorrect showing of method/function parameters and 'docstring' information #2711
Replies: 11 comments
-
Pylance is a static analyzer, and can't get that information at runtime like Jupyter does (which has already executed the code and can access the real info). In that first case, am I correct in saying that it's pandas? Our pandas stubs include the docstrings (as the "real" code produces them extremely dynamically), so it's possible some are missing. As for |
Beta Was this translation helpful? Give feedback.
-
Thanks for the quick reply. |
Beta Was this translation helpful? Give feedback.
-
Thanks. In all of those cases, you're in the "signature help" which is missing the docstrings in our stubs (and we apparently can't find it in the real implementation). @huguesv will be able to look at this later. Out of curiosity, what are you finding "odd" about the parameters? |
Beta Was this translation helpful? Give feedback.
-
Sorry, I meant that it shows all the parameter options without a 'nice' format, which is what is nicely presented in a docstring. For me the best way to show parameters and docstring is the way that Jupyter Lab represents it (as per the screenshots shown in my first post). |
Beta Was this translation helpful? Give feedback.
-
We'll need to reorganize our pandas stubs slightly to have the Right now, in stub we currently have Doing this should fix the tooltip, as well as go to definition. |
Beta Was this translation helpful? Give feedback.
-
So @huguesv in the next version the stubs will reflect the correct file layout but will still not show these docstrings, so they are likely cases where the docs are synthesized as part of pandas build. |
Beta Was this translation helpful? Give feedback.
-
I am running into this issue with Django as well. PyLance is showing the docstring-less function signature from django-stubs (which it comes bundled with) instead of the docstring in the actual Django source code. What I gather from #170 (comment) above is that PyLance should use type stubs for type info and source code for docstrings. However, with Django (for example) this is clearly not the case. For Although the source clearly has a docstring, and VSCode even offers to take me there with Ideally hover would show the type information but also any docstring. |
Beta Was this translation helpful? Give feedback.
-
Sorry to give you the rigmarole, but I think the django thing is another thing entirely, either that hovers are missing docstrings or that there's a specific bug with django given it's finding the def. This issue is about pandas docstrings being generated at runtime where the static analysis can't possibly put together what the docstrings going to be (e.g. they do something like To save you from writing that all over again, I made #316. 🙂 |
Beta Was this translation helpful? Give feedback.
-
I'm not sure whether this is the same issue as the one described above but for builtin modules I also find the behavior of PyLance very inconvenient (vs Jedi). For example, this is the documentation popup for It's badly formatted but that's not my point. As soon as I add parentheses it becomes: Notice this is not the popup that is shown while I'm typing arguments but the documentation popup shown on hover (the mouse pointer being above |
Beta Was this translation helpful? Give feedback.
-
Oh, I guess mine is this one #316 (comment) instead. |
Beta Was this translation helpful? Give feedback.
-
Moving this issue to discussion as an enhancement request for comments and upvotes. |
Beta Was this translation helpful? Give feedback.
-
Environment data
Expected behaviour
for example, in Jupyter Lab:

Actual behaviour
Not showing the correct docstring and parameters information. I don't know if this is a problem related to Python extension or Pylance.
Logs
Code Snippet / Additional information
XXX
Beta Was this translation helpful? Give feedback.
All reactions