aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Tham2021-08-16 02:03:57 +0000
committerGitHub2021-08-16 02:03:57 +0000
commitaaccc9419a9710f13db3ddc0aad068e606667154 (patch)
tree9817e3d6937efba5055fd77cd3da310e84d907b7
parent3bde65c599707d7448c36dee26848b0ed48b0fe4 (diff)
Add ledger tree-sitter (#572)
Might need to update later since the current one highlight does not work very well yet.
-rw-r--r--.gitmodules4
m---------helix-syntax/languages/tree-sitter-ledger0
-rw-r--r--languages.toml9
-rw-r--r--runtime/queries/ledger/highlights.scm38
-rw-r--r--runtime/queries/ledger/injections.scm1
5 files changed, 52 insertions, 0 deletions
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
+Subproject 72319504776f14193472a6ad14abec0af0225cb
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