File Templates
How to create new BoxLang files in IntelliJ IDEA — file templates for classes, scripts, and templates with customizable content.
The BoxLang IntelliJ plugin provides file templates for quickly creating new BoxLang files. Templates are accessible from the New menu in the Project view.
Creating a New BoxLang File
Method 1: From Project View
Right-click in the Project view (or a specific folder)
Select New → BoxLang File
Choose the file type:
BoxLang Class (
.bx)BoxLang Script (
.bxs)BoxLang Template (
.bxm)
Enter the file name (without extension)
Press Enter
Method 2: From Menu
Select File → New → BoxLang File
Choose the file type
Enter the file name
Press Enter
Method 3: Keyboard Shortcut
Press Cmd+N (Ctrl+N) in the Project view
Select BoxLang File
Choose the file type
Enter the file name
File Template Types
BoxLang Class (.bx)
Creates a new BoxLang class/component file:
Use for:
Model classes
Service classes
DAO classes
Any reusable component
BoxLang Script (.bxs)
Creates a new BoxLang script file:
Use for:
Standalone scripts
Migration scripts
Utility scripts
Command-line tools
BoxLang Template (.bxm)
Creates a new BoxLang markup template file:
Use for:
Web pages
Email templates
Report templates
Any HTML-generating template
Customizing Templates
You can customize the default templates or create your own:
Edit Existing Templates
Open Settings → Editor → File and Code Templates
Select the Templates tab
Find the BoxLang template you want to edit:
BoxLang Class
BoxLang Script
BoxLang Template
Modify the template content
Click Apply
Create Custom Templates
Open Settings → Editor → File and Code Templates
Click the + button
Enter a name (e.g., "BoxLang Service")
Set the extension (e.g.,
bx)Enter the template content
Click Apply
Template Variables
Templates support variables that are replaced when creating a file:
${NAME}
File name without extension
UserService
${PACKAGE_NAME}
Package/directory path
models.services
${USER}
Current system user
john.doe
${DATE}
Current date
2026-05-29
${TIME}
Current time
14:30:00
${YEAR}
Current year
2026
${MONTH}
Current month
05
${DAY}
Current day
29
Example: Custom Service Template
Template Best Practices
Include Documentation
Always add Javadoc-style comments:
Use Type Hints
Add type hints for better IDE support:
Follow Naming Conventions
Classes: PascalCase (
UserService,ProductDAO)Methods: camelCase (
getUser,calculateTotal)Variables: camelCase (
userName,orderTotal)Constants: UPPER_SNAKE_CASE (
MAX_RETRIES,DEFAULT_TIMEOUT)
Live Templates
In addition to file templates, IntelliJ provides Live Templates for code snippets:
Built-in Live Templates
sout
writeOutput()
soutv
writeOutput(variable)
for
for loop
fori
for loop with index
itere
for loop over collection
ifn
if (x == null)
inn
if (x != null)
Creating Live Templates
Open Settings → Editor → Live Templates
Click + and select Live Template
Enter an abbreviation (e.g.,
bxlog)Enter the template text:
Define variables (e.g.,
MESSAGE="Log message")Set the context (BoxLang files)
Click Apply
Using Live Templates
Type the abbreviation (e.g.,
bxlog)Press Tab to expand
Fill in the variables
Press Tab to move to next variable or Enter to finish
Related Pages
Last updated
Was this helpful?