hledger-lsp

A Language Server Protocol (LSP) implementation for hledger journal files. Provides IDE features like completions, diagnostics, formatting, and more for any LSP-compatible editor.
π― Features
Completions
- Accounts β Fuzzy matching with frequency-based ranking
- Payees β From transaction history with usage counts
- Commodities β From directives and usage
- Tags β Name and value completion from existing tags
- Dates β today/yesterday/tomorrow + historical dates from file
Navigation
- Go to Definition β Jump to account/commodity/payee declaration
- Find References β Find all usages across workspace
- Rename β Refactor accounts, commodities, and payees across files
- Workspace Symbol β Quick search for accounts, commodities, payees
Diagnostics
- Real-time validation of transactions
- Balance checks and syntax errors
Other
- Formatting β Automatic alignment of amounts
- Hover β Account balances on hover
- Semantic Tokens β Syntax highlighting with delta support
- Document Symbols β Outline navigation
- Folding Ranges β Collapse transactions and directives
- Document Links β Clickable include file paths
- Include Support β Multi-file journals with cycle detection
π¦ Installation
From Releases
Download the latest binary for your platform from GitHub Releases.
# macOS (Apple Silicon)
curl -L https://github.com/juev/hledger-lsp/releases/latest/download/hledger-lsp_darwin_arm64 -o hledger-lsp
chmod +x hledger-lsp
sudo mv hledger-lsp /usr/local/bin/
# macOS (Intel)
curl -L https://github.com/juev/hledger-lsp/releases/latest/download/hledger-lsp_darwin_amd64 -o hledger-lsp
chmod +x hledger-lsp
sudo mv hledger-lsp /usr/local/bin/
# Linux (x86_64)
curl -L https://github.com/juev/hledger-lsp/releases/latest/download/hledger-lsp_linux_amd64 -o hledger-lsp
chmod +x hledger-lsp
sudo mv hledger-lsp /usr/local/bin/
From Source
go install github.com/juev/hledger-lsp/cmd/hledger-lsp@latest
Verify Installation
hledger-lsp --version
π Quick Start
- Install hledger-lsp (see above)
- Configure your editor (see below)
- Open a
.journal or .hledger file
- Start typing and enjoy completions!
2024-01-15 * grocery store
expenses:food $50.00
assets:cash
π§ Editor Setup
βοΈ Configuration
See docs/configuration.md for supported settings and defaults.
βοΈ Supported Features
| Feature |
Status |
| Completions |
β
|
| Diagnostics |
β
|
| Formatting |
β
|
| Hover |
β
|
| Semantic Tokens |
β
|
| Document Symbols |
β
|
| Go to Definition |
β
|
| Find References |
β
|
| Rename |
β
|
| Folding Ranges |
β
|
| Document Links |
β
|
| Workspace Symbol |
β
|
| Inline Completion |
β
|
- Incremental updates: ~2.8ms for 1000 transactions (NFR < 50ms)
- Completion: ~3.4ms response time (NFR < 100ms)
- Parsing: ~14ms for 10k transactions (NFR < 500ms)
- Memory: ~31MB for large journals (NFR < 200MB)
See docs/benchmarks.md for detailed benchmarks.
π Resources
π License
MIT Β© Denis Evsyukov