diff --git a/.gitmodules b/.gitmodules index 87acea607..a1c0589ec 100644 --- a/.gitmodules +++ b/.gitmodules @@ -94,3 +94,7 @@ path = helix-syntax/languages/tree-sitter-latex url = https://github.com/latex-lsp/tree-sitter-latex shallow = true +[submodule "helix-syntax/languages/tree-sitter-ledger"] + path = helix-syntax/languages/tree-sitter-ledger + url = https://github.com/cbarrete/tree-sitter-ledger + shallow = true diff --git a/helix-syntax/languages/tree-sitter-ledger b/helix-syntax/languages/tree-sitter-ledger new file mode 160000 index 000000000..723195047 --- /dev/null +++ b/helix-syntax/languages/tree-sitter-ledger @@ -0,0 +1 @@ +Subproject commit 72319504776f14193472a6ad14abec0af0225cbe diff --git a/languages.toml b/languages.toml index 15d78a1af..30ef3582b 100644 --- a/languages.toml +++ b/languages.toml @@ -205,6 +205,15 @@ file-types = ["java"] roots = [] indent = { tab-width = 4, unit = " " } +[[language]] +name = "ledger" +scope = "source.ledger" +injection-regex = "ledger" +file-types = ["ldg", "ledger", "journal"] +roots = [] +comment-token = ";" +indent = { tab-width = 4, unit = " " } + # [[language]] # name = "haskell" # scope = "source.haskell" diff --git a/runtime/queries/ledger/highlights.scm b/runtime/queries/ledger/highlights.scm new file mode 100644 index 000000000..86c609c2a --- /dev/null +++ b/runtime/queries/ledger/highlights.scm @@ -0,0 +1,38 @@ +[ + (comment) + (note) +] @comment + +[ + (date) + (interval) + (quantity) +] @number + +((account) @field) +((commodity) @text.literal) + +"include" @include + +[ + "account" + "alias" + "assert" + "check" + "commodity" + "def" + "default" + "end" + "eval" + "format" + "nomarket" + "note" + "payee" + "check" + "A" + "Y" + "N" + "D" + "C" + "P" +] @keyword diff --git a/runtime/queries/ledger/injections.scm b/runtime/queries/ledger/injections.scm new file mode 100644 index 000000000..4bb7d675d --- /dev/null +++ b/runtime/queries/ledger/injections.scm @@ -0,0 +1 @@ +(comment) @comment