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

"java.saveActions.organizeImports" setting doesn't work on Windows #2207

Open
testforstephen opened this issue Nov 10, 2021 · 4 comments · May be fixed by #3015
Open

"java.saveActions.organizeImports" setting doesn't work on Windows #2207

testforstephen opened this issue Nov 10, 2021 · 4 comments · May be fixed by #3015

Comments

@testforstephen
Copy link
Collaborator

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
  1. In any Java Program in any main-function type "File f = new File("/");"
  2. 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

@itayasaf1990xd
Copy link

I just wonder why almost 1 year later and this issue did not fix yet.

@alx1024
Copy link

alx1024 commented 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
Copy link

still unresolved

@avertx
Copy link

avertx commented 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.

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

Successfully merging a pull request may close this issue.

5 participants