Skip to content
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

Adding jsdoc to overriding method makes inherited jsdoc disappear #43506

Open
jonlepage opened this issue Apr 2, 2021 · 3 comments
Open

Adding jsdoc to overriding method makes inherited jsdoc disappear #43506

jonlepage opened this issue Apr 2, 2021 · 3 comments
Labels
Domain: JSDoc Relates to JSDoc parsing and type generation Needs Proposal This issue needs a plan that clarifies the finer details of how it could be implemented. Suggestion An idea for TypeScript

Comments

@jonlepage
Copy link

When adding doc to a class for API level, if we add more doc inside the implementation, we lost some documentation !
ex here, i add * @example $AA.method() and if i add tag @implement or any others in the childClass, we lost documentations from parent and for the API level.

This image show tag:@example $AA.method() is removed!, because we add more doc in AA.method !
image

The expected behavior should be look like this (push docs and no replace) .
Work only if we add in parent , but should work if we add in child class.
image

  • VS Code Version:
    Version : 1.55.0 (user setup)
    Commit : c185983a683d14c396952dd432459097bc7f757f
    Date : 2021-03-30T16:01:55.261Z
    Electron : 11.3.0
    Chrome : 87.0.4280.141
    Node.js : 12.18.3
    V8 : 8.7.220.31-electron.0
    OS : Windows_NT x64 10.0.19042

Steps to Reproduce:

Add doc to AA.method will remove some docs in the A.method

abstract class A {
	/**  `method` to be implement for the class AA
	 * @example $AA.method()
	 */
	abstract method(): any;
}

class AA extends A {
	/**
	 * @implements more info on the implementation
	 */
	method() {
		throw new Error('Method not implemented.');
	}
}

Does this issue occur when all extensions are disabled?: Yes

@mjbvz mjbvz assigned mjbvz and unassigned jrieken Apr 2, 2021
@mjbvz mjbvz transferred this issue from microsoft/vscode Apr 2, 2021
@mjbvz mjbvz removed their assignment Apr 2, 2021
@sandersn sandersn changed the title Losing docs for API between class implementation Adding jsdoc to overriding method makes inherited jsdoc disappear Apr 2, 2021
@DanielRosenwasser DanielRosenwasser added Domain: JSDoc Relates to JSDoc parsing and type generation Needs Proposal This issue needs a plan that clarifies the finer details of how it could be implemented. Suggestion An idea for TypeScript labels Apr 2, 2021
@DanielRosenwasser
Copy link
Member

There is an @inheritdoc tag that some people use. I wonder if that's an acceptable work-around to the issue.

@jonlepage
Copy link
Author

jonlepage commented Apr 3, 2021

There is an @inheritdoc tag that some people use. I wonder if that's an acceptable work-around to the issue.

hum intersting, so if i understand this should work like thats.

abstract class A {
	/**  `method` to be implement for the class AA
	 * @example $AA.method() 
	 * @inheritdoc 
	 */
	abstract method(): any;
}

class AA extends A {
	/**
	 * @implements more info on the implementation
	 * @description more info on the implementation
	 */
	method() {
		throw new Error('Method not implemented.');
	}
}

It seem not work for now ! so i suppose it need to be implemented to ts engine right ?
I think it can be a good idea and will also avoid breakchange or destroy another's projects documentations structure.

fast test:
Every tags instead plain text look disappear also with the tag.
image

expected behavior with this tag in the context should be this ? right.
image

@DanielRosenwasser
Copy link
Member

Exactly - we'd need to implement it, but haven't gotten that much demand for it so far if I recall correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Domain: JSDoc Relates to JSDoc parsing and type generation Needs Proposal This issue needs a plan that clarifies the finer details of how it could be implemented. Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

4 participants