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

Emit JSDoc-style comments #110

Open
danmarshall opened this issue Nov 7, 2018 · 5 comments
Open

Emit JSDoc-style comments #110

danmarshall opened this issue Nov 7, 2018 · 5 comments

Comments

@danmarshall
Copy link

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 }
@beenotung
Copy link

Is it clear to decide which block do the comment belongs to?
e.g. attached to variable, class, method, property, or standalone

@danmarshall
Copy link
Author

According to this page:

JSDoc comments should generally be placed immediately before the code being documented.

@buehler
Copy link
Owner

buehler commented Feb 11, 2019

Actually, I have to see if the ts compiler does provide this information...

@buehler
Copy link
Owner

buehler commented Mar 4, 2019

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.

@buehler buehler closed this as completed Mar 4, 2019
@buehler buehler reopened this Mar 4, 2019
@buehler
Copy link
Owner

buehler commented Mar 4, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants