Formatting
Experimental BoxLang formatting support, version requirements, and configuration files
Formatting support for BoxLang is in its early stages and requires a few manual setup steps.
For full details on the BoxLang formatter itself — including all configuration options, rules, and .bxformat.json reference — see the BoxLang Formatter documentation.
How formatting works
Formatting support is powered by the BoxLang CLI format command.
If your BoxLang version is new enough, run this command to inspect the available options:
boxlang format -hThis is the same formatting foundation used by the language tooling.
Enabling formatting (beta)
There are four things you need to enable formatting during the beta period:
Enable format-on-save in VSCode
Open your VSCode settings and add the format-on-save override for BoxLang:
{
"[boxlang]": {
"editor.formatOnSave": true
}
}Open Preferences: Open Settings (JSON) from the Command Palette
Add the
[boxlang]block shown in the JSON tab
You can also enable global format-on-save if you prefer:
{
"editor.formatOnSave": true
}Once all four steps are complete, formatting is active. Saving any .bx, .bxs, .cfc, or .cfs file will trigger the formatter.
Formatter in action
The BoxLang formatter is inspired by cfformat and prettyprint. It enforces consistent style across your codebase with no manual effort.
Before formatting:
After formatting:
Configuration files
The formatter uses a BoxLang-native configuration file named .bxformat.json.
It is also compatible with cfformat.json, so existing formatter configurations continue to work.
Place either file at the workspace root to customize formatting rules. See the BoxLang Formatter documentation for the complete reference of available options.
When to use the CLI
The CLI is the fastest way to verify that your runtime supports formatting.
Use it when you need to:
confirm the
formatcommand is availableinspect supported formatter options
validate your installed BoxLang version
Related pages
For the broader language tooling stack, see Language Tools overview.
Last updated
Was this helpful?