vim-ledger icon indicating copy to clipboard operation
vim-ledger copied to clipboard

omnicompletion stops working

Open serici opened this issue 2 years ago • 9 comments

Hi,

I'm using

  • linux
  • vim 8.2
  • hledger 1.22.2

omnicompletion was working until now. When i hit tab key, omnicompletion search for a while a returns a pattern not found What should i check to find the source cause of my issue ?

my vimrc configuration is below

" ----------------------------------------------------------
" settings for vim-ledger plugin


" General settings
let g:ledger_bin = 'hledger'
let g:ledger_accounts_cmd = '-f % accounts'
let g:ledger_default_commodity = '€'
let g:ledger_commodity_before = 1


" String that will be used to fill the space between
" account name and amount in the foldtext. 
" Set this to get some kind of lines or visual aid.
let g:ledger_fillstring = '    -'

" option applied to ledger when syntax check
nnoremap <leader>hc :!hledger -f % check -s

" alignement sur la décimale

let g:ledger_decimal_sep = ','
let g:ledger_align_at = 70
au FileType ledger inoremap <silent> <Tab> <C-r>=ledger#autocomplete_and_align()<CR>
au FileType ledger vnoremap <silent> <Tab> :LedgerAlign<CR>

i tried to execute hledger -f % accounts and it worked

serici avatar Dec 18 '21 17:12 serici

"until now"

What changed? This plugin hasn't been changed much recently. Did you upgrade Vim? Hledger? Something else? Your other plugins?

alerque avatar Dec 18 '21 19:12 alerque

sure, I've upgraded my distro, not sure it is related and i haven't paid attention on what has been updated (list was too long). (haskell for sure) but don't know about vim and ledger.

is there a log or something i can check to figure out where the problem is ?

serici avatar Dec 18 '21 20:12 serici

hi,

i'm doing my homework !

  • vim works → ok
  • hledger works → ok
  • only one plugin in vim → vim-ledger
  • plugin is up to date (git pull today)
  • filetype is detected (:set returns the good filetype)
  • omnicomplete command is launched (echo msg in LedgerComplete is visible)

don't know where to look further :( . My bet is that the cash of accounts is badly loaded) but the command hledger -f % accounts works

any help would be appreciated

serici avatar Dec 24 '21 15:12 serici

I've run into this as well. omnicompletion stopped working in the middle of a session. I didn't change my system configuration at all. All I did was add entries to my ledger.

I checked out the previous version of the ledger (from before I started adding entries) and completion works fine.

Went back to current version and completion doesn't work -- I get the Pattern not found message.

atsaloli avatar Apr 07 '23 14:04 atsaloli

@atsaloli It looks like you introduced something in your ledger that is causing the CLI to output some error message instead or or in addition to the payee and accounts lists. Check the output of the respective commands to see if you are getting a clean list to complete from. I suspect you have an unbalanced transaction or something like that getting in your way.

alerque avatar Apr 07 '23 14:04 alerque

Yes!! That was it. I was just coming back to post that. Thank you. =)

If I introduce an unbalanced transaction and then save the file and re-open it, omni completion stops working. (It still works until I save my changes.)

Good to have omni completion back, it's very useful. And thank you for your help!

atsaloli avatar Apr 07 '23 14:04 atsaloli

And when I fix the unbalanced transaction and save my changes and re-open the file, omni completion works again. :+1:

atsaloli avatar Apr 07 '23 14:04 atsaloli

It would be nice if omni completion could pass that error through to facilitate troubleshooting? :)

atsaloli avatar Apr 07 '23 14:04 atsaloli

Feel free to open a new issue about that, it would be nice to surface a more useful error. I've run into it too.

Your issue however was completely unrelated to this one, the OP stated:

the command hledger -f % accounts works

Which means his deal was something else...

alerque avatar Apr 07 '23 14:04 alerque