nvimdev / lspsaga.nvim

improve neovim lsp experience
MIT License
3.41k stars 287 forks source link

nvim_win_get_config() returns numbers for col and row and not table #1397

Open antoinegomez opened 6 months ago

antoinegomez commented 6 months ago

Hello,

In codeaction/preview.lua

local function create_preview_win(content, main_winid)
  local win_conf = api.nvim_win_get_config(main_winid)

Is not returning a table with [true] and [false] for row and col and this making this function crash.

nvim --version
NVIM v0.10.0-dev
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3

I use quite a lot of plugins (woops) but here is where I reproduced it:

This happens on [1] Move to a new file action

I temporary fixed this issue by detecting that row/col are not a table and then reassign it but it might not be the right way to do, just stopping the error without refactoring to much code.

Not sure where the problem lies. I will try to reproduce with a lighter config and share it.

Error detected while processing CursorMoved Autocommands for "<buffer=4>":
Error executing lua callback: ...er/start/lspsaga.nvim/lua/lspsaga/codeaction/preview.lua:104: attempt to index field 'col' (a number value)
stack traceback:
        ...er/start/lspsaga.nvim/lua/lspsaga/codeaction/preview.lua:104: in function 'create_preview_win'
        ...er/start/lspsaga.nvim/lua/lspsaga/codeaction/preview.lua:158: in function 'action_preview'
        ...acker/start/lspsaga.nvim/lua/lspsaga/codeaction/init.lua:239: in function 'set_cursor'
        ...acker/start/lspsaga.nvim/lua/lspsaga/codeaction/init.lua:99: in function <...acker/start/lspsaga.nvim/lua/lspsaga/codeaction/init.lua:98>