Skip to content

Commit f57ed1d

Browse files
AceofSpades5757erasinthe-mikedavis
authored andcommitted
Add language: beancount (helix-editor#3297)
Co-authored-by: erasin <erasinoo@gmail.com> Co-authored-by: Michael Davis <mcarsondavis@gmail.com> Co-authored-by: Erasin <erasinoo@gmail.com>
1 parent 10f22e7 commit f57ed1d

File tree

4 files changed

+67
-0
lines changed

4 files changed

+67
-0
lines changed

book/src/generated/lang-support.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
| Language | Syntax Highlighting | Treesitter Textobjects | Auto Indent | Default LSP |
22
| --- | --- | --- | --- | --- |
33
| bash || | | `bash-language-server` |
4+
| beancount || | | |
45
| c |||| `clangd` |
56
| c-sharp || | | `OmniSharp` |
67
| cairo || | | |

languages.toml

+13
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,19 @@ indent = { tab-width = 4, unit = " " }
599599
name = "ledger"
600600
source = { git = "https://github.com/cbarrete/tree-sitter-ledger", rev = "1f864fb2bf6a87fe1b48545cc6adc6d23090adf7" }
601601

602+
[[language]]
603+
name = "beancount"
604+
scope = "source.beancount"
605+
injection-regex = "beancount"
606+
file-types = ["beancount", "bean"]
607+
roots = []
608+
comment-token = ";"
609+
indent = { tab-width = 2, unit = " " }
610+
611+
[[grammar]]
612+
name = "beancount"
613+
source = { git = "https://github.com/polarmutex/tree-sitter-beancount", rev = "4cbd1f09cd07c1f1fabf867c2cf354f9da53cc4c" }
614+
602615
[[language]]
603616
name = "ocaml"
604617
scope = "source.ocaml"

runtime/queries/beancount/folds.scm

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[
2+
(transaction)
3+
(section)
4+
] @fold
+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
(date) @variable.builtin
2+
(txn) @variable.builtin
3+
4+
(account) @type
5+
6+
[
7+
(amount)
8+
(incomplete_amount)
9+
(amount_tolerance)
10+
(number)
11+
] @constant.numeric
12+
13+
14+
[(key_value) (key)] @variable.other.member
15+
(string) @string
16+
17+
[
18+
(currency)
19+
(tag)
20+
(link)
21+
] @constant
22+
23+
(comment) @comment
24+
25+
[
26+
(minus)
27+
(plus)
28+
] @operator
29+
30+
[
31+
(balance) (open) (close) (commodity) (pad)
32+
(event) (price) (note) (document) (query)
33+
(custom) (pushtag) (poptag) (pushmeta)
34+
(popmeta) (option) (include) (plugin)
35+
] @keyword
36+
37+
38+
((headline item: (item) @markup.heading.6) @markup.heading.marker
39+
(#match? @markup.heading.marker "^\\*\\*\\*\\*\\*\\*"))
40+
((headline item: (item) @markup.heading.5) @markup.heading.marker
41+
(#match? @markup.heading.marker "^\\*\\*\\*\\*\\*"))
42+
((headline item: (item) @markup.heading.4) @markup.heading.marker
43+
(#match? @markup.heading.marker "^\\*\\*\\*\\*"))
44+
((headline item: (item) @markup.heading.3) @markup.heading.marker
45+
(#match? @markup.heading.marker "^\\*\\*\\*"))
46+
((headline item: (item) @markup.heading.2) @markup.heading.marker
47+
(#match? @markup.heading.marker "^\\*\\*"))
48+
((headline item: (item) @markup.heading.1) @markup.heading.marker
49+
(#match? @markup.heading.marker "^\\*"))

0 commit comments

Comments
 (0)