mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
feat(lsp.util): remove metatable in locations_to_items
This commit is contained in:
parent
f0973d4227
commit
0621718e3b
@ -1783,18 +1783,14 @@ function M.locations_to_items(locations, offset_encoding)
|
||||
end
|
||||
|
||||
local items = {} --- @type vim.quickfix.entry[]
|
||||
|
||||
---@type table<string, {start: lsp.Position, end: lsp.Position, location: lsp.Location|lsp.LocationLink}[]>
|
||||
local grouped = setmetatable({}, {
|
||||
__index = function(t, k)
|
||||
local v = {}
|
||||
rawset(t, k, v)
|
||||
return v
|
||||
end,
|
||||
})
|
||||
local grouped = {}
|
||||
for _, d in ipairs(locations) do
|
||||
-- locations may be Location or LocationLink
|
||||
local uri = d.uri or d.targetUri
|
||||
local range = d.range or d.targetSelectionRange
|
||||
grouped[uri] = grouped[uri] or {}
|
||||
table.insert(grouped[uri], { start = range.start, ['end'] = range['end'], location = d })
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user