Home  >  Q&A  >  body text

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

This is the content in my user settings.json.

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

Like this ordering, but don't like that Visual Studio Code removes unused imports instead of graying them out.

P粉116631591P粉116631591354 days ago609

reply all(2)I'll reply

  • P粉311617763

    P粉3116177632023-10-31 19:52:23

    Finally possible in 2021.

    Replace source.organizeImports with source.sortImports.

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

    reply
    0
  • P粉006847750

    P粉0068477502023-10-31 18:51:59

    Currently this is not possible. See https://github.com/microsoft/TypeScript/issues/36085

    reply
    0
  • Cancelreply