basedpyright icon indicating copy to clipboard operation
basedpyright copied to clipboard

[Feature Request] Properly parse multi-line descriptions for parameters in docstrings

Open rickyelopez opened this issue 10 months ago • 2 comments

Description

This is definitely a feature that is missing in Pyright, and it has been reported upstream at least twice (from my brief search) in https://github.com/microsoft/pyright/issues/9957 and https://github.com/microsoft/pylance-release/issues/6524. It seems like Microsoft wants to keep proper parameter description parsing as a pylance-exclusive feature. Is this something that you would be open to improving in basedpyright?

A number of the common docstring formats that Pyright purports to support (including Epytext and both Google variants) support parameter descriptions that span multiple lines. Pyright, however, only extracts at most one line for each parameter. This results in incomplete parameter descriptions in the hover and signature help for affected parameters.

Minimal example. Note that hovering on the parameter shows only the first line of the description from the docstring.

I have tracked down the relevant code in Pyright, which clearly only handles one line.

This would be really great to have, and from my cursory investigation it doesn't seem like it would be too bad to get something minimal in here that would vastly improve the situation. Is this something you would be willing to accept a PR for? If so, I may take a stab at it.

rickyelopez avatar May 01 '25 22:05 rickyelopez

Is this something you would be willing to accept a PR for? If so, I may take a stab at it.

That would be appreciated, thanks!

DetachHead avatar May 01 '25 22:05 DetachHead

Also have issues with the hover docs from pyright that still persists in based pyright Incorrectly formatted hover documentation. #6626. I have had a quick look through the code to try and see what is parsing this and how to specify what type of markdown is returned but i didnt get very far. i could also take a look at making some parser for numpy like docstrings if somebody could point out the place where this is done. Thank you.

Alan-Manning avatar May 06 '25 15:05 Alan-Manning