include cmp-lsp capabilities for lspconfig capabilities

This commit is contained in:
siduck 2023-08-15 20:26:06 +05:30
parent d3d9aa251a
commit 5644603144
1 changed files with 39 additions and 16 deletions

View File

@ -21,26 +21,49 @@ M.on_attach = function(client, bufnr)
end end
end end
M.capabilities = vim.lsp.protocol.make_client_capabilities() M.cmp_lsp_capabilities = {
textDocument = {
M.capabilities.textDocument.completion.completionItem = { completion = {
documentationFormat = { "markdown", "plaintext" }, dynamicRegistration = false,
snippetSupport = true, completionItem = {
preselectSupport = true, snippetSupport = true,
insertReplaceSupport = true, commitCharactersSupport = true,
labelDetailsSupport = true, deprecatedSupport = true,
deprecatedSupport = true, preselectSupport = true,
commitCharactersSupport = true, tagSupport = { valueSet = { 1 } },
tagSupport = { valueSet = { 1 } }, insertReplaceSupport = true,
resolveSupport = { resolveSupport = {
properties = { properties = {
"documentation", "documentation",
"detail", "detail",
"additionalTextEdits", "additionalTextEdits",
},
},
insertTextModeSupport = {
valueSet = {
1, -- asIs
2, -- adjustIndentation
},
},
labelDetailsSupport = true,
},
contextSupport = true,
insertTextMode = 1,
completionList = {
itemDefaults = {
"commitCharacters",
"editRange",
"insertTextFormat",
"insertTextMode",
"data",
},
},
}, },
}, },
} }
M.capabilities = vim.tbl_deep_extend("force", vim.lsp.protocol.make_client_capabilities(), M.cmp_lsp_capabilities)
require("lspconfig").lua_ls.setup { require("lspconfig").lua_ls.setup {
on_attach = M.on_attach, on_attach = M.on_attach,
capabilities = M.capabilities, capabilities = M.capabilities,