Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add language: beancount #3297

Merged
merged 14 commits into from
Aug 8, 2022
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions book/src/generated/lang-support.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
| Language | Syntax Highlighting | Treesitter Textobjects | Auto Indent | Default LSP |
| --- | --- | --- | --- | --- |
| bash | ✓ | | | `bash-language-server` |
| beancount | ✓ | | | |
| c | ✓ | ✓ | ✓ | `clangd` |
| c-sharp | ✓ | | | `OmniSharp` |
| cairo | ✓ | | | |
Expand Down
13 changes: 13 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,19 @@ indent = { tab-width = 4, unit = " " }
name = "ledger"
source = { git = "https://github.com/cbarrete/tree-sitter-ledger", rev = "1f864fb2bf6a87fe1b48545cc6adc6d23090adf7" }

[[language]]
name = "beancount"
scope = "source.beancount"
injection-regex = "beancount"
file-types = ["beancount", "bean"]
roots = []
comment-token = ";"
indent = { tab-width = 2, unit = " " }

[[grammar]]
name = "beancount"
source = { git = "https://github.com/polarmutex/tree-sitter-beancount", rev = "4cbd1f09cd07c1f1fabf867c2cf354f9da53cc4c" }

[[language]]
name = "ocaml"
scope = "source.ocaml"
Expand Down
4 changes: 4 additions & 0 deletions runtime/queries/beancount/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[
(transaction)
(section)
] @fold
35 changes: 35 additions & 0 deletions runtime/queries/beancount/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
(date) @variable.builtin
(txn) @variable.builtin

(account) @type

[
(amount)
(incomplete_amount)
(amount_tolerance)
(number)
] @constant.numeric


(key) @label
AceofSpades5757 marked this conversation as resolved.
Show resolved Hide resolved
(string) @string

[
(currency)
(tag)
(link)
] @constant

(comment) @comment

[
(minus)
(plus)
] @keyword.operator
AceofSpades5757 marked this conversation as resolved.
Show resolved Hide resolved

[
(balance) (open) (close) (commodity) (pad)
(event) (price) (note) (document) (query)
(custom) (pushtag) (poptag) (pushmeta)
(popmeta) (option) (include) (plugin)
] @keyword