Note
This is a fork of foxundermoon/vs-shell-format.
Since the original package no longer maintained, I just try to fork this package, fix this issue and re-publish new package to marketplace.
See foxundermoon#396.
Get it on the VS Code Marketplace!
Enjoy shellscript!
Note
Dockerfile support is opt-in. It is registered as a language but excluded from the default shellformat.effectLanguages, so it won't format on save unless you enable it.
The upstream tool shfmt does not officially support Dockerfile. However, the common Dockerfile syntax (e.g. RUN with shell commands) falls within the shell grammar, in this case, shfmt can format Dockerfille. Because this is not an officially supported path and may mangle complex multiline constructs, it is disabled by default — enable it only if it works for your use case.
To enable, add dockerfile to shellformat.effectLanguages, or enable shellformat.useEditorConfig and add the following to your .editorconfig:
[Dockerfile]
indent_size = 4
indent_style = space
binary_next_line = trueSee #14 for background.
| language | extension | describe |
|---|---|---|
| shellscript | .sh .bash | shell script files |
| dockerfile | Dockerfile *.dockerfile | dockerfile (opt-in) |
| ignore | .gitignore .dockerignore | ignore files |
| properties | .properties | java properties files |
| jvmoptions | .vmoptions , jvm.options | jvm options file |
| hosts | /etc/hosts | hosts file |
| bats | .bats | Bats test file |
| zsh | .zsh .zshrc .zshenv | zsh script files |
shift+option+f
shift+command+p then type Format Document
shellformat.paththe shfmt fullpath example [mac,linux]:/usr/local/bin/shfmt[windows]:C:\\bin\\shfmt.exeshellformat.flagshfmt -h to see detailed usage.
This project exists thanks to all the people who contribute. [Contribute].
Become a financial contributor and help us sustain our community. [Contribute]
Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]
