Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Please transform NumpyDoc/ RestructuredText docstrings to nice tooltips to support useful docstrings across VS Code, Jupyter and Sphinx #2294

Closed
MarcSkovMadsen opened this issue Jan 27, 2022 · 3 comments
Labels
docstrings enhancement New feature or request

Comments

@MarcSkovMadsen
Copy link

MarcSkovMadsen commented Jan 27, 2022

Hi Pyright.

I believe you are providing the tooltips formatting for VS Code python files. So here goes 😄

I am VS Code/ Pylance/ Pyright user and contributor to the HoloViz ecosystem. Especially Panel. Panel builds on Param which provides parameters for your python classes. Similar to dataclasses, attrs, traits, traitlets, pydantic, django models etc. Param is especially well suited for building reactive, GUI applications.

I started out wanting to improve the development experiment for the HoloViz ecosystem in VS Code. VS Code does not understand param.Parametrized classes. After some discussions,I figured I need to autogenerate stub files. I experiment with that here holoviz/panel#3132. It's now at a level where I can autogenerate stubs for Panel.

But then I realized that the tooltips in VS Code only formats docstrings to a limited extent. And it clearly formats Markdown formatted docstrings better than RestructuredText based docstrings.

This makes it hard to provide docstrings that work great in VS Code, Ipython/ Jupyter and Sphinx. For Sphinx The HoloViz ecosystem uses NumpyDoc/ RestructuredText based docstrings. This is not well supported as tooltips in VS Code'.

RestructuredText module docstring example

Tooltips in VS Code cannot format Restructured hyperlinks, code blocks, figure blocks etc, which makes a module docstring like attached not very useful in VS Code.

panel_init.csv (rename to .rst before use)

panel_init_rst.mp4

Here I would expect to have clickable hyperlinks, well formatted code blocks and some nice .gifs displayed. But I dont.

Markdown module docstring example

Tooltips in VS Code can format Markdown hyperlinks, code blocks, figure blocks etc, which makes a module docstring like attached very useful in VS Code. But not very useful for a python package based on NumpyDoc/ RestructuredText and using Sphinx to autogenerate documentation.

panel_init.md

panel_init_markdown.mp4

Solution

Please supported nice tooltips based on NumpyDoc/ RestructuredText docstrings. For me a minimum useful solution would be to add support for hyperlinks, code blocks and figure blocks. Then I would be able to create documentation that is useful for both VS Code and Sphinx.

@MarcSkovMadsen MarcSkovMadsen changed the title Jan 27, 2022
@erictraut
Copy link
Contributor

Thanks for the enhancement request. Since this isn't a core type checking feature and is related instead to language server features, I'm going to transfer this to the pylance-release project so it gets the appropriate attention and consideration.

@erictraut erictraut transferred this issue from microsoft/pyright Jan 27, 2022
@MarcSkovMadsen
Copy link
Author

Thanks so much 👍

@MarcSkovMadsen MarcSkovMadsen changed the title Please transform NumpyDoc/ RestructuredText docstrings to nice tootips to support useful docstrings across VS Code, Jupyter and Sphinx Please transform NumpyDoc/ RestructuredText docstrings to nice tooltips to support useful docstrings across VS Code, Jupyter and Sphinx Jan 27, 2022
@judej judej added docstrings enhancement New feature or request labels Jan 27, 2022
@github-actions github-actions bot removed the triage label Jan 27, 2022
@judej
Copy link
Contributor

judej commented Apr 20, 2022

Moving this issue to discussion as an enhancement request for comments and upvotes.

@microsoft microsoft locked and limited conversation to collaborators Apr 20, 2022
@judej judej converted this issue into discussion #2677 Apr 20, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
docstrings enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants