Expand description
Language Server Protocol implementation for Beancount.
This crate provides an LSP server for Beancount files, enabling IDE features like:
- Real-time syntax error diagnostics
- Autocompletion for accounts, currencies, payees
- Go-to-definition for accounts
- Hover information
- Document symbols (outline view)
§Architecture
The server follows rust-analyzer’s architecture:
- Main loop: Handles LSP messages, applies changes, dispatches requests
- Query database: Salsa-inspired incremental computation
- Handlers: Process LSP requests against immutable snapshots
§Example
ⓘ
fn main() -> std::process::ExitCode {
rustledger_lsp::start_stdio().map(|()| std::process::ExitCode::SUCCESS)
.unwrap_or(std::process::ExitCode::FAILURE)
}Re-exports§
pub use ledger_state::LedgerState;pub use ledger_state::LspConfig;pub use main_loop::run_main_loop;pub use main_loop::run_main_loop_with_exit_action;
Modules§
- handlers
- LSP request and notification handlers.
- ledger_
state - Ledger state management for multi-file support.
- main_
loop - Main event loop for the LSP server.
Structs§
- Server
- The LSP server.
- Snapshot
- An immutable snapshot of the world state.
- Vfs
- Virtual file system for managing open documents.
Constants§
- VERSION
- LSP server version.
Functions§
- start_
stdio - Start the LSP server using stdio transport.
- uri_
to_ path - Convert an LSP URI to a file path.