fix(lsp): support workspace/configuation with no section

This commit is contained in:
Tim Pope 2024-02-17 15:29:54 -05:00
parent b12d193b4a
commit 4541189052
3 changed files with 13 additions and 1 deletions

View File

@ -206,6 +206,9 @@ M[ms.workspace_configuration] = function(_, result, ctx)
value = vim.NIL
end
table.insert(response, value)
else
-- If no section is provided, return settings as is
table.insert(response, client.settings)
end
end
return response

View File

@ -149,9 +149,16 @@ function tests.check_workspace_configuration()
{ section = 'testSetting2' },
{ section = 'test.Setting3' },
{ section = 'test.Setting4' },
{},
{ section = '' },
},
})
expect_notification('workspace/configuration', { true, false, 'nested', vim.NIL })
local all = {
testSetting1 = true,
testSetting2 = false,
test = { Setting3 = 'nested' },
}
expect_notification('workspace/configuration', { true, false, 'nested', vim.NIL, all, all })
notify('shutdown')
end,
}

View File

@ -502,6 +502,8 @@ describe('LSP', function()
{ section = 'testSetting2' },
{ section = 'test.Setting3' },
{ section = 'test.Setting4' },
{},
{ section = '' },
},
},
{ method = 'workspace/configuration', client_id = 1 },