diff options
author | Lewis Russell <lewis6991@gmail.com> | 2024-10-16 10:06:59 +0100 |
---|---|---|
committer | Lewis Russell <lewis6991@gmail.com> | 2024-10-17 12:52:45 +0100 |
commit | 0621718e3b5f522ad2df9ef7d4332fa324bc8db5 (patch) | |
tree | 5c52fc6696252726b0f170c2bf4d37538c5ea034 /runtime/lua/vim/lsp/util.lua | |
parent | f0973d42272e9474c758c87697e3803e1796d17c (diff) | |
download | rneovim-0621718e3b5f522ad2df9ef7d4332fa324bc8db5.tar.gz rneovim-0621718e3b5f522ad2df9ef7d4332fa324bc8db5.tar.bz2 rneovim-0621718e3b5f522ad2df9ef7d4332fa324bc8db5.zip |
feat(lsp.util): remove metatable in locations_to_items
Diffstat (limited to 'runtime/lua/vim/lsp/util.lua')
-rw-r--r-- | runtime/lua/vim/lsp/util.lua | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index 2101e940f0..d42b33f7a0 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -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 |