Omni completion not working with Ledger 3.2.0
MrKyr opened this issue · 16 comments
omni completion stop working after ledger 3.2.0 update
Thanks for the report.
I primarily use hledger
, not ledger
. Can you do a little research in the changelog or release notes or whatever and see what changed? Probably the CLI command to get a list of accounts / payees / etc. changed (or perhaps the output format changed). I'm happy to get support fixed but it would be helpful if somebody using ledger (and with ledger compatible data files hanging around) could help tinker to know what needs to be done.
I found it,
it's cause to the --pedantic
flag which I have set in my .ledgerrc
config file.
Note that the Ledger 3.1.3 is working fine with this setting enabled.
Does it output anything that this plugin should be expected to parse? Or does the shell command fail to run entirely due to your configuration and the issue something this plugin can account for and lies with ledger itself and/or your configuration?
ledger itself works as expected with the --pedantic
flag set in .ledgerrc
, both versions 3.1.3
or 3.2.0
.. The problem is in the vim plugin.
When I try to omni complete <C-X><C-O>
with ledger-3.2.0
and --pedantic
flag set in my .ledgerrc
vim complains:
-- Omni completion (^O^N^P) Pattern not found`
This is the only output I have.
@MrKyr This plugin doesn't do anything too fancy, it just asks ledger
for a flat plain list of accounts / or payees, like this:
ledger -f % accounts
or:
ledger -f % payees
...where %
is either the current file or whatever you have specified in the g:ledger_main
preference.
Can you try running those commands locally to make sure they return results (and a valid exit code)?
With 3.2.0 --explicit is now always enabled (no way to disable it). This could in theory break your ledger if you crealied on cleared transactions defining your accounts or commodities.
Thanks for the hint @tbm. Not being a ledger
user myserf (I use hledger
) I am not entirely sure what the implications of the --explicit
flag are for this use case.
Assuming that I would like to setup this plugin to by default scrape the most complete list of all use accounts for the purposes of completion (with or without cleared transactions in them), what command should be run? We're just looking for a flat list with as little processing overhead during generation (i.e. as little validation as possible). Is there a way I should adapt this from the current ledger -f % accounts
used now to be as painless as possible for endusers upgrading to 3.2.0?
@alerque
Command ledger-3.2.0 -f % <accounts/payees>
list accounts or payees as normal
Commands ledger-3.2.0 --pedantic -f % accounts
and ledger --pedantic -f % payees
have the same output:
Error: Unknown payee 'payee_1'
While parsing file %, line 1529:
While parsing transaction:
> 2020/04/29 * expense_1
Error: Unknown payee 'payee_2'
While parsing file %, line 1534:
While parsing transaction:
> 2020/04/29 * expense_2
...
ledger-3.1.3 -f % <accounts/payees>
works fine with or without --pedantic
or --explicit
or with both flags enabled/disabled.
For the record, this plugin does not add any extra arguments by default. None of --pendantic
, --explicit
, or --check-payees
are used by default.
@MrKyr How do you have the plugin setup to know which version of Ledger to run? Do you have any extra flags set in vim?
:echo g:ledger_extra_options
:echo g:ledger_accounts_command
:echo g:ledger_bin
Do you have any other settings customized? Have you tried without your .ledgerrc
file entirely?
@MrKyr How do you have the plugin setup to know which version of Ledger to run? Do you have any extra flags set in vim?
- I have both versions installed in my system and I can switch between them ondemand
- No extra flags is set in vim
Do you have any other settings customized? Have you tried without your
.ledgerrc
file entirely?
Without .ledgerrc
or without --pedantic
flag everything works as normal in both ledger
versions.
For my understanding it's ledger 3.2.0 problem in which using --pedantic
flag can't parse accounts
or payees
and this affects vim-ledger
plugin omni completion
as well.
@MrKyr You aren't really giving enough information to solve this here, but at this point it's looking less and less like this is an issue with the plugin and just with the fact that you've setup a configuration that doesn't work. This plugin just needs a flat file list of accounts and another of payees. The defaults for both of these work, and by your own comments I gather that the out of box configuration works for you. If you modify the default ledger options such that this plugin's default commands no longer work, that's your issue to fix. There are configuration options to setup your own full command(s) for each list it needs.
If the default ledger -f % accounts
doesn't work you can either add arguments to it with g:ledger_extra_options
or replace it entirely with g:ledger_accounts_cmd
. See the help documentation for details.
Error: Unknown account 'account'
It's accounts -- plural
yes I have --check-payees enabled in my config
well, there you go. I suggest you remove that
@MrKyr I think the information you need to solve this one of several ways is in the last couple messages, and furthermore that it would be impossible to work around this from the plugin side without making even more problems for the default out of box use cases. Based on that I'm going to close this issue, but do feel free to comment if you feel there is something we're missing here.