mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
fix(lsp): fix lookup of boolean values in workspace/configuration (#18026)
This commit is contained in:
parent
8486c87e58
commit
6160973f36
@ -141,7 +141,7 @@ M['workspace/configuration'] = function(_, result, ctx)
|
|||||||
local response = {}
|
local response = {}
|
||||||
for _, item in ipairs(result.items) do
|
for _, item in ipairs(result.items) do
|
||||||
if item.section then
|
if item.section then
|
||||||
local value = util.lookup_section(client.config.settings, item.section) or vim.NIL
|
local value = util.lookup_section(client.config.settings, item.section)
|
||||||
-- For empty sections with no explicit '' key, return settings as is
|
-- For empty sections with no explicit '' key, return settings as is
|
||||||
if value == vim.NIL and item.section == '' then
|
if value == vim.NIL and item.section == '' then
|
||||||
value = client.config.settings or vim.NIL
|
value = client.config.settings or vim.NIL
|
||||||
|
@ -1950,8 +1950,8 @@ end
|
|||||||
function M.lookup_section(settings, section)
|
function M.lookup_section(settings, section)
|
||||||
for part in vim.gsplit(section, '.', true) do
|
for part in vim.gsplit(section, '.', true) do
|
||||||
settings = settings[part]
|
settings = settings[part]
|
||||||
if not settings then
|
if settings == nil then
|
||||||
return
|
return vim.NIL
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return settings
|
return settings
|
||||||
|
@ -119,8 +119,10 @@ function tests.check_workspace_configuration()
|
|||||||
notify('workspace/configuration', { items = {
|
notify('workspace/configuration', { items = {
|
||||||
{ section = "testSetting1" };
|
{ section = "testSetting1" };
|
||||||
{ section = "testSetting2" };
|
{ section = "testSetting2" };
|
||||||
|
{ section = "test.Setting3" };
|
||||||
|
{ section = "test.Setting4" };
|
||||||
} })
|
} })
|
||||||
expect_notification('workspace/configuration', { true; vim.NIL})
|
expect_notification('workspace/configuration', { true; false; 'nested'; vim.NIL})
|
||||||
notify('shutdown')
|
notify('shutdown')
|
||||||
end;
|
end;
|
||||||
}
|
}
|
||||||
|
@ -347,6 +347,8 @@ describe('LSP', function()
|
|||||||
{NIL, { items = {
|
{NIL, { items = {
|
||||||
{ section = "testSetting1" };
|
{ section = "testSetting1" };
|
||||||
{ section = "testSetting2" };
|
{ section = "testSetting2" };
|
||||||
|
{ section = "test.Setting3" };
|
||||||
|
{ section = "test.Setting4" };
|
||||||
}}, { method="workspace/configuration", client_id=1}};
|
}}, { method="workspace/configuration", client_id=1}};
|
||||||
{NIL, {}, {method="start", client_id=1}};
|
{NIL, {}, {method="start", client_id=1}};
|
||||||
}
|
}
|
||||||
@ -368,6 +370,7 @@ describe('LSP', function()
|
|||||||
client.config.settings = {
|
client.config.settings = {
|
||||||
testSetting1 = true;
|
testSetting1 = true;
|
||||||
testSetting2 = false;
|
testSetting2 = false;
|
||||||
|
test = {Setting3 = 'nested' };
|
||||||
}]=])
|
}]=])
|
||||||
end
|
end
|
||||||
if ctx.method == 'workspace/configuration' then
|
if ctx.method == 'workspace/configuration' then
|
||||||
|
Loading…
Reference in New Issue
Block a user