
A VS Code extension to make editing hledger journal files a bit more fun.
HLedger is an awesome plain text cli accounting tool. This extension adds syntax highlighting, formatting, sorting, and other quality-of-life improvements to make editing these files easier.
Features
- Automatically aligns account names and amounts in hledger journal files
- Rich syntax highlighting with hierarchical account coloring
- Sort journal entries by date (
Shift+Cmd+S
)
- Sort on save option (enabled by default)
- Toggle comment lines (
Cmd+/
)
- Create new monthly journal files (
Cmd+N
)
Demo
Syntax Highlighting (details)
Rich syntax highlighting with hierarchical account coloring and project tags:

Aligns amounts to a configurable column position for clean, readable journal files:

Sort by Date
Automatically sorts transactions chronologically:

Supported File Types
.journal
.hledger
.ledger
Usage
- Open a hledger journal file
- Use one of these methods to format:
- Press
Shift+Alt+F
to format the entire document
- Save the file (if format on save is enabled)
- Right-click and select "Format hledger Journal" from the context menu
- Additional commands:
- Press
Shift+Cmd+S
to sort entries by date
- Press
Cmd+/
to toggle comments on selected lines
- Press
Cmd+N
to create a new monthly journal file
Extension Settings
This extension contributes the following settings:
hledger-formatter.formatOnSave
: Enable/disable formatting on save (default: true)
hledger-formatter.sortOnSave
: Enable/disable sorting entries by date on save (default: true)
hledger-formatter.amountColumnPosition
: Column position for aligning amounts (default: 42, range: 20-100)
Example
Before formatting:
2023-01-05 Grocery Store
expenses:food $85.50
assets:bank:checking $-85.50
2023-01-10 Coffee Shop
expenses:dining:coffee $4.75
assets:cash $-4.75
After formatting:
2023-01-05 Grocery Store
expenses:food $85.50
assets:bank:checking -$85.50
2023-01-10 Coffee Shop
expenses:dining:coffee $4.75
assets:cash -$4.75
Release Notes
See CHANGELOG.md for a full list of changes in each release.
Requirements
Contributing
This is an open source project and contributions are welcome! See CONTRIBUTING.md for detailed information on:
- Setting up your development environment
- Running tests and building the extension
- Submitting pull requests
Feel free to:
- Report bugs or request features via GitHub Issues
- Submit pull requests with improvements
- Share feedback and suggestions
Support
For help and support, see SUPPORT.md
License
GPL-3.0 - see the LICENSE.md file for details