Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to enable source.organizeImports without removal of unused imports?

This is what I have in my user settings.json.

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

Love the sorting, but don’t like that Visual Studio Code is removing unused imports vs greying them out.

like image 799
sunknudsen Avatar asked Sep 10 '25 14:09

sunknudsen


1 Answers

Finally it's possible in 2021.

Replace source.organizeImports by source.sortImports.

"editor.codeActionsOnSave": {
  "source.sortImports": "explicit"
},
like image 163
zambo Avatar answered Sep 13 '25 05:09

zambo