Format yaml files with yamlfmt for VS Code.
A VS Code extension that formats yaml files using the external binary yamlfmt.
Note The binary must exist in the system path or be configured via
yamlfmt.path. See the official install instructions.
The binary is invoked with the workspace folder, containing the document to
format, as cwd. So the official documentation, regarding yamlfmt
configuration, applies.
If the file is not opened from a workspace, the extension will fallback to the
files parent directory as cwd. If that is not sufficient to pick up the right
config file, you can create a .yamlfmt at one of the common locations. i.e.
~/config/yamlfmt/ or export XDG_CONFIG_HOME. Alternatively point to the
right at via the -conf flag, in your settings.json.
You can pass extra flags from the settings.json:
{
"yamlfmt.path": "yamlfmt",
"yamlfmt.args": [],
"yamlfmt.autoInstall": false
}Note The flag
-inis always appended to the args, since the current document is passed via stdin to yamlfmt.
When yamlfmt.autoInstall is set to true, the extension will automatically download and install
the latest yamlfmt binary from GitHub releases if
it is not found in the system PATH or at the configured yamlfmt.path.
The binary is stored in the extension's global storage directory and reused on subsequent activations. The following platforms and architectures are supported:
| OS | Architectures |
|---|---|
| macOS | arm64, x86_64 |
| Linux | arm64, x86_64, i386 |
| Windows | arm64, x86_64, i386 |
Special thanks to all contributors. If you would like to contribute, please see the instructions.
This project is a fork of bluebrown/vscode-extension-yamlfmt from Nico Braun. Thanks for your work.
Artificial Intelligence (AI) tools are utilized in the development of this project. This includes AI assistance for writing and reviewing code, as well as generating the extension's icon. All AI-generated contributions are carefully reviewed and tested by human maintainers.
This project is licensed under the MIT License - see the LICENSE file for details.