Skip to content

Commit

Permalink
Add ledger tree-sitter (helix-editor#572)
Browse files Browse the repository at this point in the history
Might need to update later since the current one highlight does not
work very well yet.
  • Loading branch information
pickfire authored Aug 16, 2021
1 parent 3bde65c commit aaccc94
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions helix-syntax/languages/tree-sitter-ledger
Submodule tree-sitter-ledger added at 723195
9 changes: 9 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
38 changes: 38 additions & 0 deletions runtime/queries/ledger/highlights.scm
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions runtime/queries/ledger/injections.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(comment) @comment

0 comments on commit aaccc94

Please sign in to comment.