aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/protocol.lua
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2024-02-29 10:21:02 +0100
committerChristian Clason <c.clason@uni-graz.at>2024-02-29 11:37:30 +0100
commit2c8f36a3b0b6e9d8a8c0d0f9cafff9cbf8bcb520 (patch)
treed84b33592d6c6aaaa8e97a332f955e029be7481d /runtime/lua/vim/lsp/protocol.lua
parent86c3f284fc8569b65d5ef4becc76f8d18c59e3d3 (diff)
downloadrneovim-2c8f36a3b0b6e9d8a8c0d0f9cafff9cbf8bcb520.tar.gz
rneovim-2c8f36a3b0b6e9d8a8c0d0f9cafff9cbf8bcb520.tar.bz2
rneovim-2c8f36a3b0b6e9d8a8c0d0f9cafff9cbf8bcb520.zip
fix(lsp): use plain loop for non-list-like table of protocol values
Fixup for #27628 Closes #27669
Diffstat (limited to 'runtime/lua/vim/lsp/protocol.lua')
-rw-r--r--runtime/lua/vim/lsp/protocol.lua14
1 files changed, 11 insertions, 3 deletions
diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua
index fa614780c2..7016209372 100644
--- a/runtime/lua/vim/lsp/protocol.lua
+++ b/runtime/lua/vim/lsp/protocol.lua
@@ -1,9 +1,17 @@
--- @diagnostic disable: duplicate-doc-alias
+-- TODO(clason) can be simplified after reverse lookup is removed
+---@param t table<any, any>
+---@return number[]
local function get_value_set(t)
- return vim.iter.filter(function(i)
- return type(i) == 'number'
- end, ipairs(t))
+ local result = {}
+ for _, v in pairs(t) do
+ if type(v) == 'number' then
+ table.insert(result, v)
+ end
+ end
+ table.sort(result)
+ return result
end
-- Protocol for the Microsoft Language Server Protocol (mslsp)