Mix format on save VSCode

You could also use the extension emeraldwalk/vscode-runonsave https://github.com/emeraldwalk/vscode-runonsave
And then put the following in your settings.json:

  "emeraldwalk.runonsave": {
    "commands": [
      {
        "match": "\\.exs?$",
        "isAsync": false,
        "cmd": "cd ${workspaceRoot} && mix format ${file}"
      }
    ]
  },

This could also be useful for other commands which you want to run automatically on save.

11 Likes