nvimdev / nvimdev/lspsaga.nvim

error on performing goto_definition which jumps to an empty file

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

Nobody has claimed this yet.

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

Description

Describe the bug

jumping to a file generates a highlight (beacon) on the
first line... when the file or first line is empty, the beacon width
probably gets weirded out and produces an error

Error executing vim.schedule lua callback: ...83/.local/share/nvim/lazy/lspsaga/lua/lspsaga/window.lua:157: 'width' key must be a positive Integer
stack traceback:
        [C]: in function 'nvim_open_win'
        ...83/.local/share/nvim/lazy/lspsaga/lua/lspsaga/window.lua:157: in function 'new_float'
        ...83/.local/share/nvim/lazy/lspsaga/lua/lspsaga/beacon.lua:29: in function 'beacon'
        ...local/share/nvim/lazy/lspsaga/lua/lspsaga/definition.lua:323: in function 'handler'
        /usr/share/nvim/runtime/lua/vim/lsp/client.lua:682: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>
Steps to reproduce

bug reproduced in dartls, bashls and luals

for this example, using luals -

  • create an empty file (for a file where line 1 is empty)
  • require the empty file from another file
  • perform goto_definiton on the require statement
  • error occurs (due to jumping to empty file)

video example:

Expected behavior

not error and empty width is handled

Neovim version (nvim -v)

0.11.5

lspsaga commit

branch main commit 8efe00d (from lazy.nvim)

Terminal name/version

windows-terminal 1.23.13503.0 (inside wsl2)

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

Reproduce the goto_definition case with an empty target file using the stated luals, dartls, or bashls setup. Start in lua/lspsaga/beacon.lua and lua/lspsaga/window.lua around the reported new_float call, then inspect lua/lspsaga/definition.lua; done means the jump no longer errors when the target line is empty and the beacon width is valid.

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.