Shade.nvim icon indicating copy to clipboard operation
Shade.nvim copied to clipboard

Error when using sessions

Open carlitux opened this issue 3 years ago • 14 comments

getting this message pack/packer/start/Shade.nvim/lua/shade.lua:278: Invalid window id: 1004

carlitux avatar Apr 19 '21 14:04 carlitux

I think it is related with this https://github.com/lewis6991/gitsigns.nvim/issues/161

carlitux avatar Apr 20 '21 20:04 carlitux

I've done quite a bit of refactoring before I tested sessions, and didn't seem to have any issues. This is after having implemented support for tabpages though, which may have inadvertently fixed it.

Let me know if you're still seeing the problem.

sunjon avatar Apr 20 '21 23:04 sunjon

yes, still happening.

carlitux avatar Apr 21 '21 00:04 carlitux

What do you have sessionoptions set to?

I believe if you remove blank from sessionoptions it fixes the problem. I can't immediately think of another way to exclude the plugins windows being saved to the session file.

sunjon avatar Apr 21 '21 10:04 sunjon

So I also encounter this issue specifically with sessions. As far as I can see it works well if I don't load a session. My sessionopts are globals,buffers,curdir,tabpages,help,winpos, I don't use blank and still hit this issue

akinsho avatar Apr 21 '21 12:04 akinsho

I tried removing winpos and tabpages but still no dice

akinsho avatar Apr 21 '21 12:04 akinsho

The settings I'm using are sessionoptions = "buffers,curdir,folds,tabpages,winsize".

I used your settings without issue, it's only introducing blank that makes the problem appear for me: https://streamable.com/cdahjh

I'm not sure what else could influence it. Are there enew's in your Session.vim? (I assume the same amount as you have open windows/splits)

sunjon avatar Apr 21 '21 15:04 sunjon

There's also a debug=true config flag which gives some insight into what's happening. It's not very usable as it is, because it floods the message area and demands 'press return to continue', but the output of the session load might be helpful.

sunjon avatar Apr 21 '21 16:04 sunjon

@sunjon I just deleted my session file and started afresh and I'm no longer seeing the window errors. I had a look at the file first and there were no enew calls. I then started a new tab and closed nvim and restarted it and this created empty no name buffers (I've been trying to fix that particular issue for a while since I hate that. Not sure if it relates to how tabs are restored). This causes the issue to come back btw so any [no name] buffers seem to trigger the bug

akinsho avatar Apr 21 '21 16:04 akinsho

image

Here's a quick screen grab with debug = true

akinsho avatar Apr 21 '21 16:04 akinsho

Just doing some debug if I remove silent only from session file no more errors and all works well.

carlitux avatar Jun 03 '21 00:06 carlitux

I can confirm that removing silent only from the session file seems to fix the issue for me. However, I use startify for session management, and its convenience functions seem to add those lines automatically. I haven't debugged when or why that happens, but the side effect is I can't use shade with startify sessions :(

swanysimon avatar Jul 12 '21 01:07 swanysimon

This happens to me after restoring a session and opening the neo-tree buffer. It throws errors with virtual text all around and breaks neovim, I have no choice but to close it. My sessionoptions only contain buffers.

tralph3 avatar May 30 '22 22:05 tralph3

Hey folks, I have a fork here with a patch for this. https://github.com/0x100101/Shade.nvim

I'll probably make a PR at some point, but in the meantime if anyone wants to try it out, please do and let me know if it solves your issues.

0x100101 avatar Jun 04 '22 03:06 0x100101