Skip to content

[improve docs] organize imports upon save #480

@jabbalaci

Description

@jabbalaci

I could set up to autoformat my code upon save. However, import lines were not sorted.

From the docs I could figure out how to do it: move the cursor on an input line and press Ctrl+q Ctrl+s. But how to get it automatically? When I save my code, I wanted it fully autoformatted: 1) format the code, and 2) sort the import lines.

Actually, it's possible, but I had to ask it on a forum. Add these lines to your settings.json:

"[d]": {
    "editor.formatOnSave": true,
    "editor.codeActionsOnSave": {
      "source.organizeImports": "always"
    }
  },

Please add it to the documentation so people find it easily.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions