Emit JSDoc-style comments
Hello, thanks for this project 👍 One thing I would like to have is the JsDoc comments associated with a declaration:
/**
* A meaningless declaration.
*/
const hello = "world";
current result:
VariableDeclaration {
name: 'hello',
isConst: true,
isExported: false,
type: undefined,
start: 38,
end: 60 }
desired result:
VariableDeclaration {
comment: '/**\n * A meaningless declaration.\n */',
name: 'hello',
isConst: true,
isExported: false,
type: undefined,
start: 38,
end: 60 }
Is it clear to decide which block do the comment belongs to? e.g. attached to variable, class, method, property, or standalone
According to this page:
JSDoc comments should generally be placed immediately before the code being documented.
Actually, I have to see if the ts compiler does provide this information...
I checked the AST that is generated. Sadly, you have no clue, where comments are in the document. So the only option to add comments is to add them manually.
Therefore, this can't be implemented.
Maybe I was too fast... https://stackoverflow.com/questions/47429792/is-it-possible-to-get-comments-as-nodes-in-the-ast-using-the-typescript-compiler