ledger / vim-ledger

Vim plugin for Ledger
GNU General Public License v2.0
370 stars 56 forks source link

Account name omni completion does not include ending ")" #68

Open sorsasampo opened 6 years ago

sorsasampo commented 6 years ago

If the account name ends with ")", the auto completion does not include it.

Probably related to virtual postings syntax parsing?

alerque commented 5 years ago

Confirmed, but I'm not sure how this should be fixed. The account name itself being completed does not have the ), nor should it since the same account names can be used for virtual or real postings. But of course when completing a virtual posting the most logical thing to do would be including it.

Perhaps the solution to this it actually to turn on some kind of parentheses completion function so that typing ( automatically adds the ending parenthesis, then filling in the account name can proceed as normal.

Thoughts anyone?

sorsasampo commented 5 years ago

@alerque: account names can contain parentheses, for example: Bank:Example (BE71 0961 2345 6769)

alerque commented 5 years ago

Really. How does ledger parse virtual postings? Or is that unique to hledger? What about balance virtual postings (square brackets in hledger)? We've going to know exactly how both tools parse accounts to get this right.

tbm commented 5 years ago

Account names can't start with ( since that would make it a virtual posting but otherwise they can contain brackets and they don't have to be matched.

Actually, that's not true. Account names can start with (. It's only a virtual posting if it starts with ( and ends with ).

Test:

2019-02-03 * Foo
    A(foo    10.00 EUR
    B

2019-02-03 * Foo
    (Afoo    10.00 EUR
    B
ledger -f d accounts
(Afoo
A(foo
B