This experimental extension for Visual Studio Code enables language support for the fin plain-text accounting system.
Current features:
- Syntax highlighting for the journal format, as implemented by fin
- Diagnostics: what
finfinds in the journal, in the Problems panel - Formatting with
fin format, so format-on-save works - Ctrl-click an
includepath to open the file it names - Outline view over org-mode style
*headings - Completion of account names, from the
opendirectives of the journal
The highlighting, the outline and the completions work on their own; everything
else needs the fin binary, see Configuration.
The extension is not published in the market place. For now, clone this repo and build it manually:
git clone https://github.com/sboehler/language-fin
cd language-fin
npm install
npx vsce packageWith Nix the same package is built without a toolchain of your own, and without cloning first:
nix build github:sboehler/language-finEither way, install the VSIX file that comes out — in the repository, or under
the result the Nix build links to:
code --install-extension result/language-fin-0.0.1.vsix| Setting | What it does |
|---|---|
fin.executable |
The fin binary. A bare name is looked up on PATH. Defaults to fin. |
fin.journal |
The root journal, as a path relative to the workspace folder. See below. |
fin.diagnostics.enable |
Whether to check journals at all. Defaults to true. |
With fin.journal set, journals are checked with fin balance over that file.
That follows includes, so it also reports accounts booked to before they are
opened, and balance assertions that do not hold. An error found in an included
file is reported against that file.
Left empty, only the edited file is checked, with fin parse, which reports
syntax errors alone. That is the safe default: an included fragment does not
open the accounts it books to, so checking one on its own would invent errors.
fin reads from disk, so journals are checked when opened and when saved, not
while being typed into.
Account names are completed from the open directives the journal holds, which
the extension reads itself: with fin.journal set, from the root journal and
everything it includes, and otherwise from the edited file, its includes, and
every other .fin file in the workspace. An account is offered as soon as it is
opened, before the file it is opened in has been saved.
Requires Node.js 22 or later. A Nix flake is provided, so
nix develop (or direnv allow) gets you a shell with the right toolchain.
npm install
npm run watch # rebuild the bundle on change
npm run lint
npm test # grammar snapshots, then tsc, eslint and the VS Code tests
npm run test:grammar -- -u # update the grammar snapshots after a changeThe tests that drive fin are skipped unless FIN_TEST_BIN points at a built
binary:
FIN_TEST_BIN=../fin/target/release/fin npm testPress F5 to launch a VS Code window with the extension loaded.
Add syntax highlighting Add outline view