Pass entire text through formatWithShebang() to format()#1718
Merged
josephfrazier merged 3 commits intoprettier:masterfrom May 24, 2017
Merged
Pass entire text through formatWithShebang() to format()#1718josephfrazier merged 3 commits intoprettier:masterfrom
josephfrazier merged 3 commits intoprettier:masterfrom
Conversation
That way, we won't have to do any arithmetic on range and cursor locations when there is a shebang. See here for details: prettier#1637 (comment) This required changing comment printing such that comments that are actually shebangs are just ignored.
vjeux
reviewed
May 24, 2017
| case "CommentLine": | ||
| case "Line": | ||
| // Don't print the shebang, it's taken care of in index.js | ||
| if (options.originalText.slice(util.locStart(comment)).startsWith("#!")) |
Collaborator
Author
There was a problem hiding this comment.
oops, i'll also add an eslint rule in a separate PR
Contributor
|
Oh nice! We used to have this crazy setup because the parsers threw syntax errors with shebang. Glad to know they are now handling it :) Feel free to merge once you address my small nit |
josephfrazier
added a commit
to josephfrazier/prettier
that referenced
this pull request
May 24, 2017
vjeux
pushed a commit
that referenced
this pull request
May 24, 2017
Collaborator
Author
|
Ah, that's neat to know. Ideally, we could handle actually printing the shebang in |
josephfrazier
added a commit
to josephfrazier/prettier
that referenced
this pull request
Jun 2, 2017
Now we handle actually printing the shebang in `printComment`, rather than lopping it off beforehand and reattaching it afterward, as suggested in prettier#1718 (comment)
vjeux
pushed a commit
that referenced
this pull request
Jun 2, 2017
* Add shebang comment nodes to Flow/TypeScript ASTs Now we handle actually printing the shebang in `printComment`, rather than lopping it off beforehand and reattaching it afterward, as suggested in #1718 (comment) * Dedupe AST shebang-insertion code into helper function
This was referenced Jun 2, 2017
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
That way, we won't have to do any arithmetic on range and cursor locations
when there is a shebang. See here for details:
#1637 (comment)
This required changing comment printing such that comments that are
actually shebangs are just ignored.