Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>shfmt for IDENew to Visual Studio Code? Get it now.
shfmt for IDE

shfmt for IDE

Mufan Qiu

|
3 installs
| (0) | Free
Run shfmt (mvdan/sh) as WebAssembly inside VS Code — bundled, no binary download, cross-platform by construction.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

shfmt WASM Formatter

Marketplace Installs License

A VSCode formatter that runs mvdan/sh's shfmt directly as WebAssembly (via sh-syntax) — no binary download, no platform-specific shfmt release fetched at activation time.

Background. The older foxundermoon.shell-format extension downloads a platform-specific shfmt binary on first run, which is brittle on ARM64 Windows, dev-containers, and restricted networks. Its 7.2.8 release also ships broken ([issue #396]bug). This extension takes a different approach: bundle the same formatter as a single cross-platform WASM blob, so it just works the first time.

Install

From VSCode: search Shell Format (WASM) in the Extensions view, or:

code --install-extension MufanQiu.shell-format-wasm

Supported file types

language extension description
shellscript .sh .bash shell scripts
dockerfile Dockerfile Dockerfiles
ignore .gitignore .dockerignore ignore files
properties .properties Java properties files
jvmoptions .vmoptions jvm.options JVM options
hosts /etc/hosts hosts file
bats .bats Bats test files

Usage

  • shift+option+f (macOS) / shift+alt+f (Win/Linux), or
  • shift+cmd+p → Format Document

If VSCode asks which formatter to use, pick Shell Format (WASM) and click Configure Default.

Configuration

setting type default description
shellformat.flag string null Formatter flags, shfmt-compatible. E.g. -p -bn -ci -i 2. See shfmt flags.
shellformat.effectLanguages array all supported Which languages this extension should format.
shellformat.useEditorConfig boolean false Read formatting options from .editorconfig.

Supported flags (mapped to sh-syntax printer options):

flag effect
-p POSIX mode
-ln=<variant> Language variant: bash, posix/sh, mksh, bats
-i=<n> Indent width (0 = tabs)
-bn Binary operators on next line
-ci Indent switch cases
-sr Space after redirects
-kp Keep column-aligned padding
-fn Function { on next line
-mn Minify

Differences vs. upstream

foxundermoon.shell-format MufanQiu.shell-format-wasm
shfmt binary downloads from GitHub releases on activation not needed, WASM in-process
Works on first install broken in 7.2.8 due to missing one_ini_bg.wasm ✓
Windows ARM64 no binary released upstream ✓
shellformat.path points at external shfmt binary removed (no longer relevant)
Flags / EditorConfig ✓ ✓

Credits

  • mvdan/sh — the shell parser and formatter, MIT.
  • sh-syntax — WASM bindings of the above, MIT.
  • foxundermoon/vs-shell-format — original VSCode extension this fork is based on, MIT.

License

MIT. See LICENSE.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft