nvimdev / nvimdev/lspsaga.nvim

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

Open
#1,397 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
3.8k
Forks
308
PR merge metrics
No merged PRs in 30d

Description

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:

  • lspconfig
  • typescript-tools
  • none-ls -> code action builtin eslint
  • cssmodules_ls
  • tailwindcss

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>

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lua/lspsaga/codeaction/preview.lua, especially create_preview_win around line 104, and inspect how nvim_win_get_config(main_winid) is used. Reproduce the [1] Move to a new file action with the reported setup, then verify that preview creation no longer crashes when row and col are numbers and that the window opens correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.