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
M.capabilities = vim.lsp.protocol.make_client_capabilities()
M.capabilities.textDocument.completion.completionItem = {
documentationFormat = { "markdown", "plaintext" },
M.cmp_lsp_capabilities = {
textDocument = {
completion = {
dynamicRegistration = false,
completionItem = {
snippetSupport = true,
preselectSupport = true,
insertReplaceSupport = true,
labelDetailsSupport = true,
deprecatedSupport = true,
commitCharactersSupport = true,
deprecatedSupport = true,
preselectSupport = true,
tagSupport = { valueSet = { 1 } },
insertReplaceSupport = true,
resolveSupport = {
properties = {
"documentation",
@ -39,8 +39,31 @@ M.capabilities.textDocument.completion.completionItem = {
"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 {
on_attach = M.on_attach,
capabilities = M.capabilities,