nvimdev / nvimdev/lspsaga.nvim
`Lspsaga project_replace` error : `bad argument #1 to 'unpack'`
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 3.8k
- Forks
- 308
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
Hi,
Using the function Lspsaga project_replace test123 test throw this error :
Error executing Lua callback: ...re/nvim/lazy/lspsaga.nvim/lua/lspsaga/rename/project.lua:173: bad argument #1 to 'unpack' (table expected, got nil)
stack traceback:
[C]: in function 'unpack'
...re/nvim/lazy/lspsaga.nvim/lua/lspsaga/rename/project.lua:173: in function 'new'
...cal/share/nvim/lazy/lspsaga.nvim/lua/lspsaga/command.lua:23: in function <...cal/share/nvim/lazy/lspsaga.nvim/lua/lspsaga/command.lua:22>
...cal/share/nvim/lazy/lspsaga.nvim/lua/lspsaga/command.lua:74: in function 'load_command'
...s/.local/share/nvim/lazy/lspsaga.nvim/plugin/lspsaga.lua:8: in function <...s/.local/share/nvim/lazy/lspsaga.nvim/plugin/lspsaga.lua:7>
E16: Invalid range
I managed to make it work by replacing
args = { args[1], root_dir, '--json', unpack(args[3]) },
by
args = { args[1], root_dir, '--json', args[3) },
But I'm not really sure what I'm doing here.
Steps to reproduce
1 - Run Lspsaga project_replace arg1 arg2
2 - Throw error
Expected behavior
Show the popup as described on https://nvimdev.github.io/lspsaga/rename/
Neovim version (nvim -v)
NVIM v0.10.0-dev-2317+g44ec4b5b1
lspsaga commit
2198c07
Terminal name/version
Windows 11 Terminal - WSL
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with lua/lspsaga/rename/project.lua around line 173 and trace how Lspsaga project_replace arguments arrive from lua/lspsaga/command.lua. Reproduce the command with the issue's example and inspect the argument shape before the unpack call. Done means the command opens the documented popup without the unpack error or invalid-range message.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- developer-experience
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100