From 2c8f36a3b0b6e9d8a8c0d0f9cafff9cbf8bcb520 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 29 Feb 2024 10:21:02 +0100 Subject: fix(lsp): use plain loop for non-list-like table of protocol values Fixup for #27628 Closes #27669 --- runtime/lua/vim/lsp/protocol.lua | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'runtime/lua/vim/lsp/protocol.lua') 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 +---@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) -- cgit