Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>AL PrettierNew to Visual Studio Code? Get it now.
AL Prettier

AL Prettier

Alexander Drogin

|
2 installs
| (0) | Free
Prettier formatter for AL language in VS Code
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

AL Prettier for VS Code

A Prettier plugin for AL language and a VS Code extension that provides code formatting using this plugin.

Installation

  1. Install from VS Code Extensions Marketplace (search for "AL Prettier")
  2. Or install manually by downloading the .vsix file and running code --install-extension al-prettier-vscode-1.0.0.vsix

Usage

Format Document

  • Use the keyboard shortcut: Shift+Alt+F (Windows/Linux) or Shift+Option+F (macOS)
  • Or right-click and select "Format Document"

Format Selection

Selection formatting is currently not supported. This feature will be available in future releases.

Format on Save

Enable format on save in VS Code settings:

{
  "[al]": {
    "editor.defaultFormatter": "alexander-drogin.al-prettier-vscode",
    "editor.formatOnSave": true
  }
}

Configuration

You can customize the formatting behavior in VS Code settings:

{
  "alPrettier.tabWidth": 4,
  "alPrettier.useTabs": false,
  "alPrettier.printWidth": 120,
  "alPrettier.removeEmptyElements": false
}

Options

  • tabWidth (default: 4): Number of spaces per indentation level
  • useTabs (default: false): Use tabs instead of spaces for indentation
  • printWidth (default: 120): Specify the line length that the printer will wrap on
  • removeEmptyElements (default false): Remove elements without content (this includes table fieldgroups, page actions and layout sections)

Requirements

  • VS Code 1.75 or later
  • AL language support (from Microsoft Dynamics 365 Business Central AL Language extension)

Known issues and limitations

  • Requires valid AL syntax to format correctly. Formatting of an AL statement that cannot be parsed correctly will throw an error.
  • Range formatting is in development and currently not supported.
  • #pragma, #if not CLEANX and similar precompiler instructions are interpreted as leading comments for the next token and may be unaligned after formatting.
  • Not all AL objects are supported (yet). Currently supported objects:
    • Codeunit
    • Enum
    • Enum extension
    • Interface
    • Page
    • Page extension
    • Query
    • Report (without embedded RDL layout)
    • Table
    • Table extension

Contributing

Contributions are welcome! Please submit issues and pull requests to the repository.

License

MIT

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