Language support for ledg journals
(*.ledg, *.ledg2), backed by the ledg lsp language server:
syntax highlighting, including errors for postings that use spaces where
the journal syntax requires a tab
exact journal whitespace: Tab always inserts a literal tab,
and Enter after a transaction or posting line starts the next
posting at its account field (" ⇥"); Enter on such an
empty posting ends the transaction
live diagnostics: the whole book is recompiled with unsaved changes as you
type, and errors are shown at the line that caused them, in included files
too
account completion, segment by segment (Expenses.Food.), then by
ledg account globs (*flight, ..amz); accounts that are not open on
the transaction's date are listed last, struck through
hover an account for its balance through the transaction's date
go to definition jumps to an account's open directive
Format Document normalizes postings written with spaces
status bar: the journal file being compiled, its size and compile time;
click it to choose another journal file
Requirements
ledg with the lsp command on the PATH of the machine that hosts the
workspace (with Remote - SSH, the remote machine), or set ledg.serverPath.
Which journal is compiled
Each file uses the file of the nearest .ledg2rc in its directory or a
parent directory, otherwise the file from ~/.ledg2rc. Run ledg: Select
Journal File (or click the status bar item) to set ledg.bookFile for the
workspace instead.
Settings
ledg.serverPath: the ledg executable (default ledg)
ledg.bookFile: root journal for every file, absolute or relative to the
workspace folder; empty to detect it from .ledg2rc
Building
From the ledg repository root:
npm run vscode:package # builds vscode/ledg.vsix
npm run vscode:install # also installs it with the `code` command
In a Remote - SSH window, run npm run vscode:install in the integrated
terminal so that code installs the extension on the remote machine.