kevinhwang91 / nvim-ufo

Not UFO in the sky, but an ultra fold in Neovim.
BSD 3-Clause "New" or "Revised" License
2.23k stars 44 forks source link

Error on opening saved session #51

Closed stevanmilic closed 2 years ago

stevanmilic commented 2 years ago

Neovim version (nvim -v | head -n1)

head

Operating system/version

macOS 12.4

How to reproduce the issue

Error executing vim.schedule lua callback: UnhandledPromiseRejection with the reason:
...site/pack/packer/start/nvim-ufo/lua/ufo/fold/manager.lua:141: Vim(foldopen):E490: No fold found
stack traceback:
        ...re/nvim/site/pack/packer/start/nvim-ufo/lua/ufo/fold.lua:44: in function <Anonymous:25>

I'm getting this error when using the plugin with auto-session plugin, looks like some folds cannot be restored after entering session.

Expected behavior

  1. save session
  2. exit nvim
  3. enter nvim
  4. no error appear

Actual behavior

  1. save session
  2. exit nvim
  3. enter nvim
  4. the reported error appears

NOTE: The error doesn't happen always, and I can't understand why it fails sometimes.

kevinhwang91 commented 2 years ago

NOTE: The error doesn't happen always, and I can't understand why it fails sometimes.

Do you mean files or a single file? If a single file always happens, please provide the session file.

stevanmilic commented 2 years ago

Not always a single file, it happens with different files too (but somewhat randomly). My hunch is that fold couldn't be found (opened) to due invalid session saved or smth. And then the ufo plugins breaks on that, it doesn't affect the overall loading of session, just the ufo.