Project Configuration
How to configure BoxLang projects — boxlang.json structure, mappings, classpaths, modules, variable expansion, and VS Code integration.
The BoxLang extension reads project configuration from boxlang.json files placed at the workspace root (or any ancestor directory). This file defines virtual path mappings, classpaths, module directories, and more.
Quick Start
Create a boxlang.json at your workspace root:
{
"mappings": {
"/models": "models",
"/views": "views"
},
"modulesDirectory": [
"boxlang_modules"
]
}This tells the LSP that the logical path /models maps to the models/ directory in your workspace.
Configuration Reference
Top-Level Keys
mappings
object{}
{"/": "${user-dir}"}
Virtual path prefix to filesystem path mappings. The key is the logical prefix (must start with /) and the value is a relative or absolute directory path.
classPaths
string[]
[]
Additional directories to include in the classpath for type resolution. Paths may be absolute or relative to boxlang.json.
modulesDirectory
string[]
["boxlang_modules"]
Directories containing BoxLang modules. Defaults to boxlang_modules/ relative to boxlang.json. Paths may be absolute or relative.
Mappings
Mappings are the core of project configuration. They tell the LSP how to resolve logical module paths (like /models, /coldbox) to actual filesystem locations.
Rules:
Keys must start with
/Values can be relative (to
boxlang.json) or absoluteThe
/mapping defines the root of your application
ClassPaths
Use classPaths to include additional directories for Java class resolution:
Modules Directory
BoxLang modules are located in standardized directories:
The default boxlang_modules/ directory is relative to your boxlang.json file.
Variable Expansion
Paths support variable expansion using the ${variable} syntax:
${boxlang-home}
The active BoxLang Home directory (default: ~/.boxlang)
${user-dir}
The user's home directory
${env.VAR}
The value of the environment variable VAR
${env.VAR:default}
The value of VAR, or default if not set
Example
VS Code Integration
boxlang.json Schema Validation
The extension provides JSON schema validation for boxlang.json files. This gives you:
Autocomplete for top-level keys
Validation of value types
Hover documentation for each setting
Error highlighting for invalid values
The schema matches any file named boxlang.json (e.g., boxlang.json, my-boxlang.json).
Workspace Mappings Override
The VS Code setting boxlang.mappings allows you to override project mappings directly in your editor settings:
Mapping Resolution Order
When the language server resolves virtual paths for diagnostics and symbol lookup, it merges mappings from several sources:
ColdBox implicit module mappings
boxlang.json.bxlint.jsonThe nearest
Application.bxorApplication.cfcVS Code
boxlang.mappings
This means project mappings can be refined for analysis in .bxlint.json, overridden locally in editor settings, or supplied directly from application-level static this.mappings entries.
Complete Example
A comprehensive boxlang.json for a ColdBox application:
Relationship to Other Config Files
boxlang.json
Project structure — mappings, classpaths, modules
.bxlint.json
Static analysis rules and file filters
.bxformat.json
Code formatting rules
VS Code settings.json
Editor-level overrides and IDE preferences
Related Pages
Settings ReferenceVersion ManagementLintingFormattingLast updated
Was this helpful?