-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Fix regression organize imports duplicates comments #38599
Fix regression organize imports duplicates comments #38599
Conversation
src/services/textChanges.ts
Outdated
@@ -286,6 +286,12 @@ namespace ts.textChanges { | |||
this.deletedNodes.push({ sourceFile, node }); | |||
} | |||
|
|||
public deleteNode(sourceFile: SourceFile, node: Node, options: ConfigurableStartEnd = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }): void { | |||
const startPosition = getAdjustedStartPosition(sourceFile, node, options); | |||
const endPosition = getAdjustedEndPosition(sourceFile, node, options); |
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.
use getAdjustedRange instead
* upstream/master: Use control flow analysis to check 'super(...)' call before 'this' access (microsoft#38612) LEGO: check in for master to temporary branch. Make `processTaggedTemplateExpression` visit a returned node goToDefinition: find only the value if it's the RHS of an assignment Fix regression organize imports duplicates comments (microsoft#38599) Fix crash in JS declaration emit (microsoft#38508)
@typescript-bot cherry-pick this to release-3.9 |
@typescript-bot cherry-pick this to release-3.9 I wonder if you need to be added to a list/role somewhere |
Heya @andrewbranch, I've started to run the task to cherry-pick this into |
Hey @andrewbranch, I've opened #38668 for you. |
🤖 Pick PR #38599 (Fix regression organize imports dup...) into release-3.9
Fixes #38507
#37467 started preserving comments when deleting unused declarations. When organize imports creates a sorted list of imports, it deletes the old imports in the same way. This caused us to start duplicating comments when organizing imports.