-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Automatically print inner comments #15080
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/53256/ |
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.
Great!
/* D */ default /* E */class /* F */{/* G */} /* H */ No newline at end of file | ||
/* D */ default /* E */class /* F */{/* G */} /* H */ |
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.
Great change.
/* 0 */import /* 1 */ module /* 2 */from /* 3 */ from /* 4 */"./module.wasm" /* 5 */; |
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.
There is an inconsistency in the spaces here, but there have been similar ones in the past, and ignoring them should be fine.
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.
Yeah I tried to fix some of them, but they have different causes and I couldn't figure out how ti fix all of them 😅
/*1*/for /* 2 */ /*3*/ await ( /*4*/using /*5*/fo /*6*/ of /*7*/of /*8*/) /*9*/; |
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.
The original behavior is better for me, but I don't mind the new one.
@@ -1,3 +1,3 @@ | |||
class C { | |||
async [/* 2 */foo /* 3 */] /* 1 */ /* 4 */ /* 5 */() {} | |||
async /* 1 */ /* 4 */ /* 5 */ [/* 2 */foo /* 3 */]() {} |
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.
The original behavior is better for me, but I don't mind the new one.
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.
Yeah the problem is that there is no "correct" answer: due to how we mix inner comments, two of 1/4/5 will be in the wrong place.
This PR updates
@babel/generator
to automatically print.innerComments
whenever there are two contiguous "raw" tokens (i.e. not nested nodes). By doing so, we reduce the risk of accidentally forgetting to print inner comments.