From aaccc9419a9710f13db3ddc0aad068e606667154 Mon Sep 17 00:00:00 2001 From: Ivan Tham Date: Mon, 16 Aug 2021 10:03:57 +0800 Subject: Add ledger tree-sitter (#572) Might need to update later since the current one highlight does not work very well yet.--- .gitmodules | 4 ++++ helix-syntax/languages/tree-sitter-ledger | 1 + languages.toml | 9 ++++++++ runtime/queries/ledger/highlights.scm | 38 +++++++++++++++++++++++++++++++ runtime/queries/ledger/injections.scm | 1 + 5 files changed, 53 insertions(+) create mode 160000 helix-syntax/languages/tree-sitter-ledger create mode 100644 runtime/queries/ledger/highlights.scm create mode 100644 runtime/queries/ledger/injections.scm diff --git a/.gitmodules b/.gitmodules index 87acea60..a1c0589e 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 00000000..72319504 --- /dev/null +++ b/helix-syntax/languages/tree-sitter-ledger @@ -0,0 +1 @@ +Subproject commit 72319504776f14193472a6ad14abec0af0225cbe diff --git a/languages.toml b/languages.toml index 15d78a1a..30ef3582 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 00000000..86c609c2 --- /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 00000000..4bb7d675 --- /dev/null +++ b/runtime/queries/ledger/injections.scm @@ -0,0 +1 @@ +(comment) @comment -- cgit v1.2.3-70-g09d2