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

Revise whitespace handling in JSDoc #24217

Open
weswigham opened this issue May 17, 2018 · 0 comments
Open

Revise whitespace handling in JSDoc #24217

weswigham opened this issue May 17, 2018 · 0 comments
Labels
Bug A bug in TypeScript
Milestone

Comments

@weswigham
Copy link
Member

weswigham commented May 17, 2018

Ref #24184

Our JSDoc scanner currently always scans whitespace and newlines as significant - the constant need to skip or ignore these tokens, then fix up node positions to account for them (or ignore them) is a brittle process - especially as the jsdoc scanner is interwoven with the normal scanner for certain parts of jsdoc parsing, which does make whitespace insignificant. The JSDoc scanner should behave more like the normal scanner or JSX scanner where whitespace is insignificant (and never has a token made for it), and comment text has an alternate scan mode that munches on all text until something indicates the comment's end (for capturing descriptions).
AFAIK, whitespace is captured as a token right now to capture indentation for descriptions; however description start position and the raw text of the description should be sufficient to derive the re-indented value. Descriptions should probably be nodes, like JSXText, with a range and a processed value (kinda like an identifier or a literal) - this way the original source text remains available via the range, but also have a processed value that's has spare blank lines and indentation stripped away (this would help the classifier quite a bit, as it relies on a bunch of implicit structure in the JSDoc parser and AST to capture them today).

@mhegazy mhegazy added the Bug A bug in TypeScript label May 17, 2018
@mhegazy mhegazy added this to the Future milestone Jul 23, 2018
@sandersn sandersn removed their assignment Jan 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript
Projects
None yet
Development

No branches or pull requests

3 participants