-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Conversation
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).
@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). |
Plus cleanup some lint
Also update a couple of missed spots in the previous undo commits
@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.
let advanceToken = true; | ||
let state = JSDocState.SawAsterisk; | ||
let margin: number | undefined = undefined; | ||
let indent = start - Math.max(content.lastIndexOf("\n", start), 0) + 4; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
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