-
Notifications
You must be signed in to change notification settings - Fork 481
Open
Labels
Description
This issue is originally created by @alx1024 at microsoft/vscode-java-debug#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
Trass3r and Cloud7050
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
itayasaf1990xd commentedon Aug 17, 2022
I just wonder why almost 1 year later and this issue did not fix yet.
alx1024 commentedon Aug 17, 2022
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, },
adiantek commentedon Dec 13, 2022
still unresolved
java.saveActions.organizeImports
#3015avertx commentedon Sep 19, 2023
but wait! regardless of saving, copy/paste code should carry imports from the source
having to search for this one was/is a bummer.