Skip to content

Classes and interfaces lose hover JSDoc comments from parent class/interface when re-declaring properties #2035

@Bertie690

Description

@Bertie690

Extension Version

v0.20251107.1

VS Code Version

1.105.1

Also occurs when using TSGo with the Zed editor (extension version 0.0.3 and editor version 0.211.6), so it's likely not a VS Code impl issue.

Operating system Version

Ubuntu x86-64 (WSL, though I highly doubt this matters)

Steps to reproduce

Copy the following MRE into a new .ts file in the editor.

interface foo {
  /** base jsdoc */
  bar(k: string): number;
  /** other jsdoc */
  other: 24;
}

interface bar extends foo {
  bar(k: string | symbol): number | 99;
}

declare class thing {
  /** doc comment */
  method(s: string): void;
}

declare class potato extends thing {
  method(s: "1234"): void;
}

declare const f: foo;
declare const b: bar;
declare const t: thing;
declare const p: potato;

// b and p lack comments on the properties they overrode (`bar` and `method` respectively)
f.bar;
f.other;
b.bar;
b.other;
t.method;
p.method;

Hover over the bottom 6 symbols and notice how b and p's overridden methods lack hover comments.

Issue

The interfaces and classes should inherit the parents' doc comments if they themself lack an accompanying JSDoc comment, as happens with normal tsc.

NB: This also occurs with classes implementing interfaces and interfaces extending classes.

Images

Playground = tsc, editor = tsgo

Image Image Image Image

Remarks

Our codebase uses this feature a very large amount to avoid re-documenting interface properties on implementing classes, so a fix would be greatly appreciated.

Metadata

Metadata

Assignees

Labels

Domain: EditorRelated to the LSP server, editor experience

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions