Julian / lean.nvim

neovim support for the Lean theorem prover
MIT License
255 stars 25 forks source link

Correct way to quit neovim while the plugin is running #290

Closed tomaz1502 closed 1 year ago

tomaz1502 commented 1 year ago

Hi, I'm having an issue when trying to quit neovim with :wqa when running the plugin in a file. It seems that this happens every time I try to close the infoview as the last window open. After neovim finishes, I got the following message in the shell:

Error executing vim.schedule lua callback: ...ck/packer/start/plenary.nvim/lua/plenary/async/async.lua:18: The coroutine failed with this message: ...im/site/pack/packer/start/lean.nvim/lua/lean/widgets.lua:440: Vim:E315: ml_get: invalid lnum: 2
stack traceback:
        [C]: in function 'error'
        ...ck/packer/start/plenary.nvim/lua/plenary/async/async.lua:18: in function 'callback_or_next'
        ...ck/packer/start/plenary.nvim/lua/plenary/async/async.lua:45: in function 'step'
        ...ck/packer/start/plenary.nvim/lua/plenary/async/async.lua:48: in function 'execute'
        ...ck/packer/start/plenary.nvim/lua/plenary/async/async.lua:118: in function 'update'
        ...m/site/pack/packer/start/lean.nvim/lua/lean/infoview.lua:1031: in function '__update_pin_by_uri'
        ...e/nvim/site/pack/packer/start/lean.nvim/lua/lean/lsp.lua:85: in function 'fn'
        ...nvim/site/pack/packer/start/lean.nvim/lua/lean/_util.lua:129: in function <...nvim/site/pack/packer/start/lean.nvim/lua/lean/_util.lua:125>
        ...e/nvim/site/pack/packer/start/lean.nvim/lua/lean/lsp.lua:8: in function 'handler'
        ....mount_nvimLBl7lb/usr/share/nvim/runtime/lua/vim/lsp.lua:1049: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>%
rish987 commented 1 year ago

This seems to be related to #283. By the looks of it, instead of getting the E322 error, you're getting a lower-level error. Also, de3dac11828a3907051b759cdbd21e45b19856c8 didn't fix the original error message for me, I am still getting the E322 error. I have a feeling that we will need to investigate the guts of vim.api.nvim_buf_set_lines to figure this out.

One clue is that it seems to only happen when quitting vim, so perhaps we're trying to update the infoview after the :quit procedure tears down the temporary buffer (or something like that). For now though, I think you can safely ignore it.

Julian commented 1 year ago

I haven't seen this error in awhile personally. Going to close, but if someone does still see this pipe up and I'll reopen.