You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, if you uncomment the line addFixComment(newExport); then the output changes to this:
functionfoo(){returntrue;}// This is some comment added to the new export statement.export{foo};functionbar(){returnfalse;}
There are additional, unexpected (at least to me) new lines before and after the new statement and its comment(s). I would have expected it to look like this instead:
functionfoo(){returntrue;}// This is some comment added to the new export statement.export{foo};functionbar(){returnfalse;}
Is there some reason the printer has this behavior, or is this a bug with how comments are rendered? I haven't noticed this behavior in all situations when adding comments to constructed nodes, but it definitely appears in this context.
The text was updated successfully, but these errors were encountered:
In this case, since this is a single line being added, the comment and spacing "make sense" but if we added multiple statements, the newline would still be inserted after the first statement:
//// originalline1;line2;line3;
//// intended replacementline1;// The following lines were alterednewLine2a;newLine2b;newLine2c;line3;
//// actual replacementline1;// The following lines were alterednewLine2a;newLine2b;newLine2c;line3;
https://gist.github.com/molisani/eb2352b755264eac718cf956bd3ac0f7
The above code snippet will print out the following:
However, if you uncomment the line
addFixComment(newExport);
then the output changes to this:There are additional, unexpected (at least to me) new lines before and after the new statement and its comment(s). I would have expected it to look like this instead:
Is there some reason the printer has this behavior, or is this a bug with how comments are rendered? I haven't noticed this behavior in all situations when adding comments to constructed nodes, but it definitely appears in this context.
The text was updated successfully, but these errors were encountered: