Skip to content
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

source.organizeImports is replicating last comment line #38507

Closed
datanotion opened this issue May 12, 2020 · 2 comments · Fixed by #38599
Closed

source.organizeImports is replicating last comment line #38507

datanotion opened this issue May 12, 2020 · 2 comments · Fixed by #38599
Assignees
Labels
Bug A bug in TypeScript Domain: Organize Imports Issues with the organize imports feature Fix Available A PR has been opened for this issue

Comments

@datanotion
Copy link

datanotion commented May 12, 2020

Using Code Insiders build:

Version: 1.46.0-insider
Commit: 288852d8c26d797974bfb8aed06e1bff9b809223
Date: 2020-05-12T05:42:38.380Z (12 hrs ago)
Electron: 7.2.4
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Darwin x64 19.4.0

Problem: If you have organizeImports enabled, such as:

	"editor.codeActionsOnSave": {
		"source.organizeImports": true
	},

and you save a file with comments in the import area, such as:

// comment1
import { Component, h, Prop, State } from "@stencil/core";
// comment2
import { CloudService } from "../../services/cloud";

and then save the file, it will replicate the last comment line under all of the imports like this:

After first save

// comment1
import { Component, h, Prop, State } from "@stencil/core";
// comment2
import { CloudService } from "../../services/cloud";
// comment2

After 2nd save

// comment1
import { Component, h, Prop, State } from "@stencil/core";
// comment2
import { CloudService } from "../../services/cloud";
// comment2
// comment2

Etc...

@andrewbranch
Copy link
Member

/cc @jessetrinity, maybe this looks familiar to you?

@jessetrinity
Copy link
Contributor

jessetrinity commented May 14, 2020

With #37467 we stopped deleting comments when deleting unused declarations. I'm less familiar with organize imports but it probably now copies the comments while no longer deleting the old ones.

The immediate fix would be to go back to removing the comments when deleting imports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: Organize Imports Issues with the organize imports feature Fix Available A PR has been opened for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants