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,17 +21,17 @@ 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,
completionItem = {
snippetSupport = true, snippetSupport = true,
preselectSupport = true,
insertReplaceSupport = true,
labelDetailsSupport = true,
deprecatedSupport = true,
commitCharactersSupport = true, commitCharactersSupport = true,
deprecatedSupport = true,
preselectSupport = true,
tagSupport = { valueSet = { 1 } }, tagSupport = { valueSet = { 1 } },
insertReplaceSupport = true,
resolveSupport = { resolveSupport = {
properties = { properties = {
"documentation", "documentation",
@ -39,8 +39,31 @@ M.capabilities.textDocument.completion.completionItem = {
"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,