nvimdev / nvimdev/lspsaga.nvim
range from source doesn't seem to use correct column
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
if I use viw to select function name, range_from_source still return the whole line
Steps to reproduce
local start = vim.fn.getpos("v")
local end_ = vim.fn.getpos(".")
local start_row = start[2]
local start_col = start[3]
local end_row = end_[2]
local end_col = end_[3]
-- A user can start visual selection at the end and move backwards
-- Normalize the range to start < end
if start_row == end_row and end_col < start_col then
end_col, start_col = start_col, end_col
elseif end_row < start_row then
start_row, end_row = end_row, start_row
start_col, end_col = end_col, start_col
end
if vim.api.nvim_get_mode().mode == "V" then
start_col = 1
local lines = vim.api.nvim_buf_get_lines(0, end_row - 1, end_row, true)
end_col = #lines[1]
end
return {
["start"] = { start_row, start_col - 1 },
["end"] = { end_row, end_col - 1 },
}
Expected behavior
return exact column
Neovim version (nvim -v)
NVIM v0.10.1 Build type: Debug LuaJIT 2.1.1713484068 Run "nvim -V1 -v" for more info
lspsaga commit
latest
Terminal name/version
tmux
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 by locating the range_from_source implementation in the lspsaga.nvim source and reproduce the issue in Neovim using the provided visual-selection example. Trace how start_col and end_col are converted into the returned range, then verify that selecting a function name returns its exact columns rather than the whole line.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100