beancount-lsp icon indicating copy to clipboard operation
beancount-lsp copied to clipboard

[Bug] Doesn't handle plugins written in Python

Open iamkroot opened this issue 6 months ago • 5 comments

In general, a plugin can arbitrarily rewrite the ledger. The server should work with the ledger after the rewrites have been applied. This can be retreived from beancount's parse Python function.

Eg: The auto_insert_open plugin from upstream beancount inserts open directives after parsing the entire beancount file. These should show up in the completions.

iamkroot avatar Oct 25 '25 17:10 iamkroot

For completion of account name, it didn't check for open directives, once it is used in postings, It should be able to show up in completion items.

Image

For python plugins, There is no way to support plugins on browser side. So the diagnostic might have problem.

Implementing all the Beancount features is almost equivalent to re-implementing Beancount in JavaScript. Even then, it wouldn't support many Beancount plugins. It is a very large work. for diagnostics, I hope to maintain the current simple implementation. For options, I plan to support as much as possible, but it definitely won't fully implement all of Beancount's features.

Originally posted by @fengkx in #11

fengkx avatar Oct 27 '25 06:10 fengkx

Is it possible to have certain features available only in local vscode, while keeping them disabled on the browser? Should be a fair compromise I think

iamkroot avatar Oct 27 '25 06:10 iamkroot

Is it possible to have certain features available only in local vscode, while keeping them disabled on the browser?

It is already like this now.

What features? Which plugin? Cloud you provide an example. I don't think auto open account have problem in completion.

fengkx avatar Oct 27 '25 06:10 fengkx

Here's an example-

; Set the operating currency
option "operating_currency" "USD"

; Load the plugin
; plugin "plugins.auto_insert_open"
plugin "beancount.plugins.auto_accounts"

;
; Without the plugin, the transaction below would cause an error
; because the accounts 'Assets:Checking' and 'Expenses:Groceries'
; have not been explicitly opened with a directive like:
; 2025-01-01 open Assets:Checking
;
; The 'auto_insert_open' plugin automatically adds these 'open'
; directives using the date of the first transaction (2025-10-26).
;

2025-10-26 * "Corner Market" "Weekly groceries"
  Assets:Checking     -75.50 USD
  Expenses:Groceries   75.50 USD

2025-10-27 * "Gas Station" "Fill up car"
  Assets:Checking        -45.00 USD
  Expenses:Automobile:Gas  45.00 USD

2025-10-26 * "Payee" "Narration"
  ; should autocomplete the auto-opened accounts

The autocompletion is not working at all in this case.

iamkroot avatar Oct 27 '25 06:10 iamkroot

Image

Can't reproduce this. The completion do not require an account definition(open directive). Once it is used, it should be shown in completion items.

fengkx avatar Oct 27 '25 07:10 fengkx