Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

check if code_win is nill #110

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

i3Cheese
Copy link

Every time a window opens or closes before :SymbolsOutline (like packer.nvim or telescope) I getting this error.
This change works for me

Error detected while processing WinEnter Autocommands for "*":
E5108: Error executing lua ...art/symbols-outline.nvim/lua/symbols-outline/preview.lua:24: Expected Lua number
stack traceback:
[C]: in function 'nvim_win_is_valid'
...art/symbols-outline.nvim/lua/symbols-outline/preview.lua:24: in function 'has_code_win'
...art/symbols-outline.nvim/lua/symbols-outline/preview.lua:221: in function 'close'
[string ":lua"]:1: in main chunk
[C]: in function 'resume'
...im/site/pack/packer/opt/packer.nvim/lua/packer/async.lua:12: in function <...im/site/pack/packer/opt/packer.nvim/lua/packer/async.lua:11>

E5108: Error executing lua Vim(lua):E5108: Error executing lua ...art/symbols-outline.nvim/lua/symbols-outline/preview.lua:24: Expected Lua number
stack traceback:
[C]: in function 'nvim_win_is_valid'
...art/symbols-outline.nvim/lua/symbols-outline/preview.lua:24: in function 'has_code_win'
...art/symbols-outline.nvim/lua/symbols-outline/preview.lua:221: in function 'close'
[string ":lua"]:1: in main chunk
[C]: in function 'execute'
.../site/pack/packer/opt/packer.nvim/lua/packer/display.lua:879: in function 'quit'
[string ":lua"]:1: in main chunk
stack traceback:
[C]: in function 'execute'
.../site/pack/packer/opt/packer.nvim/lua/packer/display.lua:879: in function 'quit'
[string ":lua"]:1: in main chunk

Every time a window opens or closes before :SymbolsOutline (like packer.nvim or telescope) I getting this error.
This change works for me

Error detected while processing WinEnter Autocommands for "*":
E5108: Error executing lua ...art/symbols-outline.nvim/lua/symbols-outline/preview.lua:24: Expected Lua number
stack traceback:
        [C]: in function 'nvim_win_is_valid'
        ...art/symbols-outline.nvim/lua/symbols-outline/preview.lua:24: in function 'has_code_win'
        ...art/symbols-outline.nvim/lua/symbols-outline/preview.lua:221: in function 'close'
        [string ":lua"]:1: in main chunk
        [C]: in function 'resume'
        ...im/site/pack/packer/opt/packer.nvim/lua/packer/async.lua:12: in function <...im/site/pack/packer/opt/packer.nvim/lua/packer/async.lua:11>

E5108: Error executing lua Vim(lua):E5108: Error executing lua ...art/symbols-outline.nvim/lua/symbols-outline/preview.lua:24: Expected Lua number
stack traceback:
        [C]: in function 'nvim_win_is_valid'
        ...art/symbols-outline.nvim/lua/symbols-outline/preview.lua:24: in function 'has_code_win'
        ...art/symbols-outline.nvim/lua/symbols-outline/preview.lua:221: in function 'close'
        [string ":lua"]:1: in main chunk
        [C]: in function 'execute'
        .../site/pack/packer/opt/packer.nvim/lua/packer/display.lua:879: in function 'quit'
        [string ":lua"]:1: in main chunk
stack traceback:
        [C]: in function 'execute'
        .../site/pack/packer/opt/packer.nvim/lua/packer/display.lua:879: in function 'quit'
        [string ":lua"]:1: in main chunk
@ianbattersby
Copy link

ianbattersby commented Feb 19, 2022

+1 for this, I just had to make the same/similar change on v0.7.0-dev+1115-g5cb45dffb.

diff --git a/lua/symbols-outline/preview.lua b/lua/symbols-outline/preview.lua
index 2ad4885..9b5680f 100644
--- a/lua/symbols-outline/preview.lua
+++ b/lua/symbols-outline/preview.lua
@@ -18,6 +18,9 @@ local function is_current_win_outline()
 end
 
 local function has_code_win()
+	if not main.state.code_win then
+		return false
+	end
 	local isWinValid = vim.api.nvim_win_is_valid(main.state.code_win)
 	if not isWinValid then
 		return false

@simrat39
Copy link
Owner

Should be fixed now

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants