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

Remove service's jsdoc parser and enhance parser's jsdoc parser #10671

Merged
merged 11 commits into from
Sep 15, 2016

Conversation

sandersn
Copy link
Member

@sandersn sandersn commented Sep 1, 2016

Previously, the services code parsed the comment part of jsdoc and the parser parsed the type information of jsdoc. This change makes the parser parse both comments and type information from jsdoc. The parser now parses jsdoc for both TypeScript and JavaScript.

It doesn't add much coverage of other jsdoc tags, and it doesn't fix all the annoying architectural problems, but it closes almost all of the jsdoc bugs people have found so far:

Fixes #7136
Fixes #6810
Fixes #6992
Fixes #7243
Fixes #9809
Fixes #9882
Fixes #9971
Fixes #10535

Also modify scanner's definition of leading vs trailing comments, with
associated changes to emitter and emit baselines (the last is in a
separate commit).
@sandersn
Copy link
Member Author

sandersn commented Sep 1, 2016

@RyanCavanaugh you may be interested in this change if you like parsers (because I improved one), or if you don't (because I got rid of another one).

@sandersn
Copy link
Member Author

sandersn commented Sep 2, 2016

@yuit you said you wanted to read parser code for some reason, so here it is. :] 🎁

Also use a `pushComments` function, which fixes a spacing bug.
@mhegazy mhegazy mentioned this pull request Sep 13, 2016
let advanceToken = true;
let state = JSDocState.SawAsterisk;
let margin: number | undefined = undefined;
let indent = start - Math.max(content.lastIndexOf("\n", start), 0) + 4;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where'd 4 come from?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh. That part is embarassing. 4 === '/** '.length, basically. I should add a comment like the one on line 6179

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.