Skip to content

Class docstring applied to fields of class (as Pycharm does) #4711

@xxc-zsz

Description

@xxc-zsz

Code:

@dataclass
class SessionMetadata:
    """Metadata of a Session

    Attributes:
        created_at: Date of creation, in POSIX timestamp format.
        usage_count: The number of times the session was applied to the payload.
    """

    created_at: int
    usage_count: int

Vscode:

image

PyCharm:

image

If I write the code like this in VScode, the hover document can be displayed:

@dataclass
class SessionMetadata:
    created_at: int
    """
    Date of creation, in POSIX timestamp format.
    """

    usage_count: int
    """
    The number of times the session was applied to the payload.
    """

image

But how to display the document in the first way of annotation?

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions