"java.saveActions.organizeImports" setting doesn't work on Windows
This issue is originally created by @alx1024 at https://github.com/microsoft/vscode-java-debug/issues/1071
[provide a description of the issue]
Environment
- Operating System: Win 10
- JDK version: 11
- Visual Studio Code version: 1.62.0
- Java extension version: 1.0.0
- Java Debugger extension version: 0.36.0
Steps To Reproduce
- In any Java Program in any main-function type "File f = new File("/");"
- Save File
Current Result
Even with checkbox checked in settings menu "Java > Save Actions: Organize Imports" (which results in
"java.saveActions.organizeImports": true
in settings.json): imports are not automatically organized
Expected Result
Imports are automatically organized on file save with setting checked
Additional Informations
if you modify the settings.json manually to:
"editor.codeActionsOnSave": { "source.organizeImports": true }
regardless if Java > Save Actions-option is checked, imports work, but you have to search for this solution on Stackoverflow
I just wonder why almost 1 year later and this issue did not fix yet.
yeah, for now on my machine it can be solved like this: ignore any settings in the settings UI. And just add this in your settings.json file:
"editor.codeActionsOnSave": { "source.organizeImports": true, "source.addMissingImports": true, },
still unresolved
but wait! regardless of saving, copy/paste code should carry imports from the source
having to search for this one was/is a bummer.