tree-sitter-beancount
tree-sitter-beancount copied to clipboard
Uppercase, incomplete accounts result in `ERROR` nodes
The following example:
2023-10-01 * "payee example" "narration exampl"
A
Produces the following tree:
(file ; [0, 0] - [2, 0]
(transaction ; [0, 0] - [1, 0]
date: (date) ; [0, 0] - [0, 10]
txn: (txn) ; [0, 11] - [0, 12]
payee: (payee) ; [0, 13] - [0, 28]
narration: (narration)) ; [0, 29] - [0, 47]
(ERROR ; [1, 0] - [1, 3]
(ERROR))) ; [1, 2] - [1, 3]
Turning the initial lowercase results into an identifier instead:
2023-10-01 * "payee example" "narration exampl"
a
(file ; [0, 0] - [2, 0]
(transaction ; [0, 0] - [1, 0]
date: (date) ; [0, 0] - [0, 10]
txn: (txn) ; [0, 11] - [0, 12]
payee: (payee) ; [0, 13] - [0, 28]
narration: (narration)) ; [0, 29] - [0, 47]
(ERROR ; [1, 0] - [1, 3]
(identifier))) ; [1, 2] - [1, 3]
This impacts LSP completion (which relies on TreeSitter), because uppercase letters won't get account completion. Ref: https://github.com/polarmutex/beancount-language-server/issues/477.