Skip to content

Conversation

@weswigham
Copy link
Member

@weswigham weswigham commented Mar 23, 2018

I talked over our current comment emit state with @rbuckton for a bit, and I'm pretty sure this is the right way to fix the issue until a more comprehensive system is in place.

Alternative to #22832.
Fixes #22831
Fixes #22723
Fixes #22724
Fixes #22731

@weswigham weswigham requested review from a user and amcasey March 23, 2018 20:21
@weswigham weswigham force-pushed the check-emit-position-for-positional-comments branch from 5aa3a69 to 4b63c3c Compare March 23, 2018 20:22
@amcasey: Preserve leading trivia when organizing imports

When organizing imports, we used to move the leading and trailing trivia
of each individual import with that import as it was repositioned or
deleted.  This had the unfortunate effect of repositioning or deleting
the header comment of the file.

Our new approach is to leave the leading trivia of the first import
ahead of the resulting block of imports (i.e. it no longer follows the
first import as it is repositioned or deleted).  Trailing trivia on the
first import and trivia on subsequent imports are treated as before.
Copy link
Member

@amcasey amcasey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This is much better. Please just make sure to include my description of the original issue & fix.

@weswigham weswigham force-pushed the check-emit-position-for-positional-comments branch from 4b63c3c to be85343 Compare March 23, 2018 20:34
@weswigham weswigham merged commit 0736554 into microsoft:master Mar 23, 2018
@weswigham weswigham deleted the check-emit-position-for-positional-comments branch March 23, 2018 21:13
weswigham added a commit to weswigham/TypeScript that referenced this pull request Mar 23, 2018
…ix (microsoft#22836)

@amcasey: Preserve leading trivia when organizing imports

When organizing imports, we used to move the leading and trailing trivia
of each individual import with that import as it was repositioned or
deleted.  This had the unfortunate effect of repositioning or deleting
the header comment of the file.

Our new approach is to leave the leading trivia of the first import
ahead of the resulting block of imports (i.e. it no longer follows the
first import as it is repositioned or deleted).  Trailing trivia on the
first import and trivia on subsequent imports are treated as before.
weswigham added a commit that referenced this pull request Mar 26, 2018
…ix (#22836) (#22840)

@amcasey: Preserve leading trivia when organizing imports

When organizing imports, we used to move the leading and trailing trivia
of each individual import with that import as it was repositioned or
deleted.  This had the unfortunate effect of repositioning or deleting
the header comment of the file.

Our new approach is to leave the leading trivia of the first import
ahead of the resulting block of imports (i.e. it no longer follows the
first import as it is repositioned or deleted).  Trailing trivia on the
first import and trivia on subsequent imports are treated as before.
@microsoft microsoft locked and limited conversation to collaborators Jul 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

2 participants