Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>Ark Format: ShellNew to Visual Studio Code? Get it now.
Ark Format: Shell

Ark Format: Shell

Tooark

|
177 installs
| (1) | Free
| Sponsor
Format Shell scripts (.sh, .bash, .bats, .zsh) with comprehensive code formatting options using the built-in engine or shfmt
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Ark Format: Shell

Open VSX Version Open VSX Downloads License: MIT

A robust formatting extension for Shell scripts (sh, bash, zsh, and more) in Visual Studio Code.
Keep your scripts consistently formatted with flexible configuration and optional integration with shfmt.

🌍 Languages: USA Flag English (this file) · Brazil Flag Português


✨ Features

  • 🎯 Full document formatting — format entire files with a single command
  • ✏️ Selection formatting — format only the selected text
  • 🎛️ Highly configurable — control indentation, spacing, and formatting behavior
  • 🌍 Multi-language UI — English (EN) and Brazilian Portuguese (PT-BR)
  • 📋 .editorconfig support — respects project configuration (optional)
  • 🔌 shfmt integration — use shfmt as a formatting engine (optional)
  • ⚡ Optimized performance — fast and lightweight processing

🚀 Getting Started

Install

  • Open VSX: https://open-vsx.org/extension/tooark/ark-format-shell
  • VS Code Marketplace: https://marketplace.visualstudio.com/items?itemName=tooark.ark-format-shell

Or inside VS Code:

  1. Open Extensions (Ctrl+Shift+X / Cmd+Shift+X)
  2. Search for Ark Format: Shell
  3. Click Install

🧩 How to Use

Preview

Ark Format Shell - Configurações

Ark Format Shell - Formatando Código

Format a Full Document

  • Press Shift+Alt+F (Windows/Linux) or Shift+Option+F (Mac)
  • Or use the command: Editor: Format Document

Format a Selection

  • Select the text you want to format
  • Press Ctrl+K Ctrl+F (Windows/Linux) or Cmd+K Cmd+F (Mac)
  • Or use the command: Editor: Format Selection

Tip: You can set Ark Format as the default formatter for Shell files to ensure consistent formatting on save.


📄 Supported File Types

  • .sh — POSIX Shell
  • .bash — Bash
  • .zsh — Zsh
  • .ksh — KornShell
  • .tcsh — TCSH
  • .azcli — Azure CLI
  • .bats — BATS tests

🔧 shfmt Integration

You can configure Ark Format to use shfmt as the formatting engine.

Use this if:

  • You already use shfmt in CI/CD
  • You want standardized formatting across tools
  • You prefer shfmt’s formatting rules

Example:

{
  "arkFormatShell.engine": "shfmt"
}

⚙️ Configuration

Customize the behavior in settings.json. Available options:

{
  "arkFormatShell.enabled": true,
  "arkFormatShell.indentSize": 2,
  "arkFormatShell.indentStyle": "space",
  "arkFormatShell.trimTrailingWhitespace": true,
  "arkFormatShell.maxConsecutiveBlankLines": 1,
  "arkFormatShell.removeLeadingBlankLines": true,
  "arkFormatShell.insertFinalNewline": true,
  "arkFormatShell.lineEnding": "LF",
  "arkFormatShell.collapseSpaces": true,
  "arkFormatShell.rangeFormatting.enabled": true,
  "arkFormatShell.rangeFormatting.reindent": false,
  "arkFormatShell.rangeFormatting.useDocumentContext": true
}

Description of Settings

Option Default Description
enabled true Enables or disables the extension
indentSize 2 Number of spaces per indentation level
indentStyle space Indentation type (space or tab)
trimTrailingWhitespace true Removes trailing whitespace
maxConsecutiveBlankLines 1 Maximum number of consecutive blank lines
removeLeadingBlankLines true Removes leading blank lines
insertFinalNewline true Inserts a new line at the end of the file
lineEnding LF Line break type (Auto, LF, CRLF)
collapseSpaces true Converts multiple spaces into one
spacing.spaceBeforeThenDo true Adds space before then and do
spacing.spaceAfterKeywords true Adds space after keywords
spacing.spaceBeforeFunctionBrace true Adds space before the function brace
rangeFormatting.enabled true Enables range formatting
rangeFormatting.reindent false Reindents the selected range
rangeFormatting.useDocumentContext true Uses document context in formatting
engine internal Defines the formatting engine (internal or shfmt)
useEditorConfig false Uses the context of the .editorconfig file for configuration

💡 Tips & Best Practices

  • Use Selection Formatting to adjust only specific parts without affecting the rest of the file
  • Configure .editorconfig in your project to maintain consistency between tools
  • Combine with other formatting extensions for a complete workflow

🤝 Contributing

  • Open an issue: Tooark/vscode-ark-format/issues
  • Suggest improvements or report bugs with examples to help reproduction

💖 Support

If this extension helps your workflow, consider supporting its development:

  • 💙 GitHub Sponsors
  • ☕ Ko-fi
  • 💸 PayPal

Every contribution helps keep the project maintained and improving. Thank you! 🙏


📝 License

This project is licensed under the MIT License.

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