DEVSENSE / phptools-docs

PHP Tools public content
Apache License 2.0
83 stars 10 forks source link

Use Quick Fix "Remove Unused Uses and Sort" in codeActionsOnSave #683

Closed Morgy93 closed 1 month ago

Morgy93 commented 1 month ago

Hello,

there is a Quick Fix "Remove Unused Uses and Sort":

image

I want to be able to use that in the actions on save:

"editor.codeActionsOnSave": {
      "source.fixAll": "explicit",
      "source.fixAll.eslint": "explicit",
      "source.organizeImports": "explicit" <---- does not do what the quick fix does
  },

Is it possible to add some some phptools.removeUnusedUsesAndSort or bind it to the system source.organizeImports?

jakubmisek commented 1 month ago

Thank you for pointing this out.

We've changed the default behavior in "editor.codeActionsOnSave" so it behaves the same as other languages in VSCode.

To "Remove Unused and Sort' on save, use the following

  "source.sortAndRemoveImports": "explicit"

I'll update the documentation as well.