basedpyright icon indicating copy to clipboard operation
basedpyright copied to clipboard

Transform RestructuredText docstrings to nice tooltips

Open rabh-deshaw opened this issue 8 months ago • 4 comments

Description

Hello! When writing Sphinx-style Python docstrings, the hover tooltip shows them in their native form i.e., without formatting. For instance, in this playground example, hovering over add shows the content as it is in the docstring.

Could we support proper rendering of these docstrings in the hover tooltips? There was a similar feature request in Pyright which was transferred over to Pylance which now supports this formatting (issue), albeit as an experimental feature.

rabh-deshaw avatar Jun 18 '25 05:06 rabh-deshaw

Similarly, this could be extended to handling Google-style docstrings, that have headings like Args:. As an example, this is Pylance:

Image

And this is Basedpyright:

Image

Pylance is converting the Args to a markdown heading, and then indenting and splitting the parameters over lines, with the description below. I'm not sure how they'd do it, they must have some parser they're using that detects the docstring format. This expands to multiple places where there are hovers, such as hovering over variables and parameters too.

Kayzels avatar Aug 15 '25 07:08 Kayzels

i've opened a separate issue for that: #1432

DetachHead avatar Aug 16 '25 02:08 DetachHead

+1: It would be very helpful to see the part of Args: or equiv. specific to the parameter/argument I'm filling in.

finite-state-machine avatar Aug 17 '25 12:08 finite-state-machine

I prefer the latter. The word "Args" unnecessarily occupies too much of my screen.

tooruu avatar Nov 21 '25 10:11 tooruu