VS Code extension for formatting any file using external command.
- Install https://github.com/lxl66566/anyformatter-vscode
- Edit
settings.json
to add your formatter command and arguments. Example:"anyformatter": { "toml": { "command": "taplo fmt -" }, "nix": { "command": "nixfmt -" } },
- Set anyformatter as default formatter.
"[toml]": { "editor.formatOnSave": true, "editor.defaultFormatter": "lxl66566.anyformatter-vscode" }, "[nix]": { "editor.formatOnSave": true, "editor.defaultFormatter": "lxl66566.anyformatter-vscode" },
Note that the external formatter must be able to accept stdin and output to stdout.