Skip to content

organizeImports without the reordering ("remove unused imports" being its own option) #43141

Closed
@jasonwilliams

Description

@jasonwilliams

Suggestion

I was originally using the organizeImports in my "editor.codeActionsOnSave" block on VSCode. The issue with this feature is it also does the sorting which we don't want.

It's currently not possible to switch the sorting off without losing the "remove unused imports".

According to VSCode documentation "addMissingImports" is offered as an "on save" option, but not "removeUnusedImports".

⭐ Suggestion

As some projects already use tools which handle ordering it would be nice to just add/remove imports without changing the order.

Then have a separate command which handles ordering.

💻 Use Cases

My team are happy with the ordering of imports and don't want changes. However by keeping the ordering I lose the ability to remove unused imports.

Example

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions