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

Better Organize Imports #1575

Open
brunoborges opened this issue Aug 12, 2020 · 4 comments
Open

Better Organize Imports #1575

brunoborges opened this issue Aug 12, 2020 · 4 comments

Comments

@brunoborges
Copy link

Documentation mentions the following feature:

Organize imports
    - triggered manually or on save
    - when pasting code into a java file with Ctrl+Shift+v (Cmd+Shift+v on Mac).

How do I disable automatic organize import on save?
How do I disable the re-sorting of import statements?

@brunoborges brunoborges changed the title Better Organize Import Better Organize Imports Aug 12, 2020
@brunoborges
Copy link
Author

brunoborges commented Aug 12, 2020

Just found this in the source code. But still no option to disable the sorting.

java.saveActions.organizeImports

@fbricon
Copy link
Collaborator

fbricon commented Aug 13, 2020

java.saveActions.organizeImports is disabled by default. Organize imports on save can also be triggered via the generic

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

Organize imports always sorts imports (and removes unused ones). It's currently not possible to only remove unused imports. However, this feature exists in JDT so we could expose it in jdt.ls/vscode-java. We could also expose a preference to sort imports like

@Strum355
Copy link

Strum355 commented Aug 21, 2020

edit: misread "source.organizeImports": true as false, sorry!

@vagusX
Copy link

vagusX commented Jul 14, 2021

Just wondering any option to disable sorting import statements? @fbricon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants