Skip to content

Preserve documentation and comments #18

@Tatsh

Description

@Tatsh

Currently no comments are preserved.

This is the input:

/** UUID or string. */
type UUIDOrString = UUID | string;

interface Obj {
  /** The object ID. */
  id: string;
  /**
   * A longer description.
   * Part 2.
   * Part 3.
   */
  name: string; // A comment here.
}

Expected output:

UUIDOrString = UUID | str;
"""UUID or string."""

class Obj(TypedDict):
    id: str
    """The object ID."""
    name: str  # A comment here.
    """
    A longer description.
    Part 2.
    Part 3.
    """

An option like --no-comments could exist to ignore comments but keep docblocks, as well as --no-docs. Another option would be to output the alternative field description syntax (#: above the field) but currently VS Code's Python extension does not support this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions