Skip to content

Render google-style docstrings to markdown #1007

@Gankra

Description

@Gankra

Currently we punt on this and just wrap the raw contents in a plaintext codeblock:
https://github.com/astral-sh/ruff/blob/6de84ed56eac4f1f3efe9d8a9d47c9b30a445707/crates/ty_ide/src/docstring.rs#L65-L73

The format looks like this:

This is a function description.

Args:
    param1 (str): The first parameter description
    param2 (int): The second parameter description
        This is a continuation of param2 description.
    param3: A parameter without type annotation

Returns:
    str: The return value description

This is an interesting case where doing a partial job can often be worse than doing nothing at all, as the current output is readable but ugly. A partial job may end up being unreadable. I've also received warning that these formats tend to be un(der)specified, and even if they weren't, you need to handle malformed inputs gracefully.

Metadata

Metadata

Assignees

Labels

serverRelated to the LSP server

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions