mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-05 11:18:26 +00:00
fix(picker.util): more relaxed resolve_loc
This commit is contained in:
parent
cd5eddb1de
commit
964beb1148
1 changed files with 6 additions and 1 deletions
|
@ -261,7 +261,12 @@ function M.resolve_loc(item, buf)
|
|||
|
||||
---@param pos lsp.Position?
|
||||
local function resolve(pos)
|
||||
return pos and { pos.line + 1, M.str_byteindex(lines[pos.line + 1], pos.character, item.loc.encoding) } or nil
|
||||
if not pos then
|
||||
return
|
||||
end
|
||||
local line = lines[pos.line + 1]
|
||||
local col = line and M.str_byteindex(line, pos.character, item.loc.encoding) or pos.character
|
||||
return { pos.line + 1, col }
|
||||
end
|
||||
item.pos = resolve(item.loc.range["start"])
|
||||
item.end_pos = resolve(item.loc.range["end"]) or item.end_pos
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue