mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 12:27:24 +00:00
Fix lsp tests breaking from new LuaJIT version
Apparently the new version of LuaJIT changed the consistency with which it sorted table dictionaries. IIRC lua sorts dictionary keys by memory address, so it would appear that the reasons tests were previously passing was because of a differentiation in the implementation of the lua runtime. Ensure that array fields in the lsp protocol tables are consistently created, by using ipair when generating arrays for completionItemKind and symbolItemKind. For CodeActionKind, the current implementation includes both the keys and the values in the array. This is incorrect. Ensure that only the values are included in the array and sort them for consistency.
This commit is contained in:
committed by
James McCoy
parent
9c5b4c87e1
commit
e8ae3ade77
@@ -292,8 +292,9 @@ local constants = {
|
||||
}
|
||||
|
||||
for k, v in pairs(constants) do
|
||||
vim.tbl_add_reverse_lookup(v)
|
||||
protocol[k] = v
|
||||
local tbl = vim.deepcopy(v)
|
||||
vim.tbl_add_reverse_lookup(tbl)
|
||||
protocol[k] = tbl
|
||||
end
|
||||
|
||||
--[=[
|
||||
@@ -623,7 +624,11 @@ function protocol.make_client_capabilities()
|
||||
|
||||
codeActionLiteralSupport = {
|
||||
codeActionKind = {
|
||||
valueSet = vim.tbl_values(protocol.CodeActionKind);
|
||||
valueSet = (function()
|
||||
local res = vim.tbl_values(protocol.CodeActionKind)
|
||||
table.sort(res)
|
||||
return res
|
||||
end)();
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -643,7 +648,7 @@ function protocol.make_client_capabilities()
|
||||
completionItemKind = {
|
||||
valueSet = (function()
|
||||
local res = {}
|
||||
for k in pairs(protocol.CompletionItemKind) do
|
||||
for k in ipairs(protocol.CompletionItemKind) do
|
||||
if type(k) == 'number' then table.insert(res, k) end
|
||||
end
|
||||
return res
|
||||
@@ -689,7 +694,7 @@ function protocol.make_client_capabilities()
|
||||
symbolKind = {
|
||||
valueSet = (function()
|
||||
local res = {}
|
||||
for k in pairs(protocol.SymbolKind) do
|
||||
for k in ipairs(protocol.SymbolKind) do
|
||||
if type(k) == 'number' then table.insert(res, k) end
|
||||
end
|
||||
return res
|
||||
@@ -708,7 +713,7 @@ function protocol.make_client_capabilities()
|
||||
symbolKind = {
|
||||
valueSet = (function()
|
||||
local res = {}
|
||||
for k in pairs(protocol.SymbolKind) do
|
||||
for k in ipairs(protocol.SymbolKind) do
|
||||
if type(k) == 'number' then table.insert(res, k) end
|
||||
end
|
||||
return res
|
||||
|
||||
Reference in New Issue
Block a user