Skip to content

Documentation for how to format docstrings for correct tooltips using Jedi #6676

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

Closed
Lexicality opened this issue Jul 23, 2019 · 10 comments
Closed
Assignees
Labels
area-editor-* User-facing catch-all area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. feature-request Request for new features or functionality

Comments

@Lexicality
Copy link

From my understanding of reading things like DonJayamanne#38 and #107, it's possible for python to display function parameters like javascript:
Screenshot 2019-07-23 at 11 20 35

However, I've tried every docstring format under the sun I can find (and tried both Jedi and the PLS) and I can't seem to cause this to happen. The entire docstring always ends up on one line:
Screenshot 2019-07-23 at 11 22 36

I can't find any documentation for how docstrings are parsed, displayed or the "best" way to write them.

(PS I'm aware there are a huge number of conflicting opinions as to what the best docstring format is, however I don't have any skin in that game. I just want my code completion to work)

@Lexicality Lexicality added triage-needed Needs assignment to the proper sub-team feature-request Request for new features or functionality labels Jul 23, 2019
@brettcannon
Copy link
Member

Specifically what are you after that isn't covered by DonJayamanne#38 and just supporting some docstring format to properly format it? You mention "code completion to work", so are you referring to the JavaScript screenshot only showing argument-specific docstring details compared to the Python one that shows everything?

@Lexicality
Copy link
Author

Is showing argument-specific docstring details not a thing?

I opened this issue because I can't find any concrete explanation as to how docstrings are processed / supported. Possibly it's hidden in an issue comment somewhere that I've missed.

I am asking for an explanation in the readme / the extension page / the visualstudio.com python section / wherever that explains the current situation clearly.

@DonJayamanne DonJayamanne added this to the 2019 - July Sprint 15 milestone Jul 25, 2019
@DonJayamanne DonJayamanne self-assigned this Jul 25, 2019
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Jul 25, 2019
@DonJayamanne DonJayamanne added needs proposal Need to make some design decisions and removed triage labels Jul 30, 2019
@DonJayamanne DonJayamanne removed their assignment Jul 30, 2019
@DonJayamanne DonJayamanne removed this from the 2019 - July Sprint 15 milestone Jul 31, 2019
@brettcannon brettcannon added the area-editor-* User-facing catch-all label Oct 21, 2019
@brettcannon brettcannon added area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. and removed feature-code documentation labels Apr 9, 2020
@Brodersen
Copy link

The current hover info is not very practical.

hover

It would be really helpful to see just some (even the unformatted) docstring, until a better solution has been found. Or at least make it an option.

@brettcannon brettcannon changed the title Documentation for how to format docstrings for correct tooltips Documentation for how to format docstrings for correct tooltips using Jedi Aug 5, 2020
@brettcannon
Copy link
Member

As a general note, this issue is specifically targeted at Jedi (I have updated the title accordingly). If you are having issues with Pylance, then please report them at https://github.com/microsoft/pylance-release.

@Lexicality
Copy link
Author

Is there documentation on how to format docstrings for Pylance somewhere?

@brettcannon
Copy link
Member

@Lexicality not that I'm aware of (I don't believe they have added specific docstring format support yet; I would open an issue on their repo).

@trir262
Copy link

trir262 commented Dec 9, 2020

From what I can tell, the docstring is parsed as a markdown document.
so as long as you respect the extra blank lines, vscode will show it properly.

Example

def function(x : int):
"""
# Summary: function summary goes here

longer description goes here, really explaining the purpose

## Inputs:

    x : int

## Returns:

    int
"""

@varunagrawal
Copy link

@trir262 is correct, but that breaks from all standard docstring conventions, making it extra work and cost to update the documentation, when instead having an option for the docstring tooltip should suffice.

@karrtikr
Copy link

Thanks for your feedback! We have released a new and more performant language server called Pylance which likely solves these issues you are reporting.  You can download Pylance from the marketplace and install it alongside the core Python extension. Because our team's development efforts have shifted to support the new language server, we'd encourage you to try it out. If you try out Pylance and this issue persists, you can open an issue on the pylance-release repo.

@luabud
Copy link
Member

luabud commented Dec 6, 2023

I believe this behaviour has changed since we moved our Jedi support to https://github.com/pappasam/jedi-language-server, so I'm closing this. But let me know if you can still reproducing this and we can reopen!

@luabud luabud closed this as completed Dec 6, 2023
@github-actions github-actions bot removed the needs proposal Need to make some design decisions label Dec 6, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-editor-* User-facing catch-all area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

8 participants