https://github.com/adrogin/al-prettier
Prettier plugin for Business Central's AL language
https://github.com/adrogin/al-prettier
al bcopensource code formatter vscode-extension
Last synced: 4 days ago
JSON representation
Prettier plugin for Business Central's AL language
- Host: GitHub
- URL: https://github.com/adrogin/al-prettier
- Owner: adrogin
- License: mit
- Created: 2026-04-19T15:08:01.000Z (3 months ago)
- Default Branch: master
- Last Pushed: 2026-07-10T09:12:42.000Z (9 days ago)
- Last Synced: 2026-07-10T10:04:36.972Z (9 days ago)
- Topics: al, bcopensource, code, formatter, vscode-extension
- Language: JavaScript
- Homepage:
- Size: 1.44 MB
- Stars: 4
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AL Prettier for VS Code
A [Prettier](https://prettier.io/) plugin for AL language and a VS Code extension that provides code formatting using this plugin.

## Installation
1. Install from VS Code Extensions Marketplace (direct link: [AL Prettier](https://marketplace.visualstudio.com/items?itemName=alexander-drogin.al-prettier-vscode) or search for "AL Prettier")
2. Or install manually by downloading the `.vsix` file and running `code --install-extension al-prettier-vscode-0.4.1.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:
```json
{
"[al]": {
"editor.defaultFormatter": "alexander-drogin.al-prettier-vscode",
"editor.formatOnSave": true
}
}
```
## Configuration
You can customize the formatting behavior in VS Code settings:
```json
{
"alPrettier.tabWidth": 4,
"alPrettier.useTabs": false,
"alPrettier.printWidth": 120,
"alPrettier.groupGlobalVars": "none",
"alPrettier.noLineBreaksInAttributes": false,
"alPrettier.removeEmptyElements": false,
"alPrettier.collapseEmptyBraces": true
}
```
### 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
- **groupGlobalVars** (default: "none"): Group all global vars in the object. Available options: "none" - keep the variables as is; "top": move all variable declarations to the top, after the object properties; "bottom": move variables to the bottom; "beforeCode": place variables before procedures.
- **noLineBreaksInAttributes** (default: false): Disable wrapping of procedure attributes even if the line exceeds maximum print width. Attributes are always printed in a single line.
- **removeEmptyElements** (default false): Remove elements without content (this includes table fieldgroups, page actions and layout sections)
- **collapseEmptyBraces** (default true): Place curly braces without content between them on one line. This option applies, for example, to table field or key definitions without properties.
## 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 implemented.
- Report objects with embedded RDLC layout are not supported.
## Contributing
Contributions are welcome! Please submit issues and pull requests to the repository.
## License
MIT