sunjon / Shade.nvim

An Nvim lua plugin that dims your inactive windows
MIT License
478 stars 26 forks source link

Error when using sessions #2

Open carlitux opened 3 years ago

carlitux commented 3 years ago

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

carlitux commented 3 years ago

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

sunjon commented 3 years ago

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.

carlitux commented 3 years ago

yes, still happening.

sunjon commented 3 years ago

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.

akinsho commented 3 years ago

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 commented 3 years ago

I tried removing winpos and tabpages but still no dice

sunjon commented 3 years ago

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 commented 3 years ago

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.

akinsho commented 3 years ago

@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 commented 3 years ago

image

Here's a quick screen grab with debug = true

carlitux commented 3 years ago

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

swanysimon commented 3 years ago

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 :(

tralph3 commented 2 years ago

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.

0x100101 commented 2 years ago

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.