From 02676d4224850886e8026f48919dbbe5ed330591 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Sun, 3 Nov 2024 18:34:43 +0100 Subject: [PATCH] lsp: avoid loading cmp on startup --- modules/plugins/lsp/config.nix | 55 +++++++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/modules/plugins/lsp/config.nix b/modules/plugins/lsp/config.nix index c9581d0d..4109c5c2 100644 --- a/modules/plugins/lsp/config.nix +++ b/modules/plugins/lsp/config.nix @@ -116,7 +116,60 @@ in { end local capabilities = vim.lsp.protocol.make_client_capabilities() - ${optionalString usingNvimCmp "capabilities = require('cmp_nvim_lsp').default_capabilities()"} + ${optionalString usingNvimCmp '' + -- TODO: copied from cmp-nvim-lsp. If we ever lazy load lspconfig we + -- should re-evaluate whether we can just use `default_capabilities` + capabilities = { + textDocument = { + completion = { + dynamicRegistration = false, + completionItem = { + snippetSupport = true, + commitCharactersSupport = true, + deprecatedSupport = true, + preselectSupport = true, + tagSupport = { + valueSet = { + 1, -- Deprecated + } + }, + insertReplaceSupport = true, + resolveSupport = { + properties = { + "documentation", + "detail", + "additionalTextEdits", + "sortText", + "filterText", + "insertText", + "textEdit", + "insertTextFormat", + "insertTextMode", + }, + }, + insertTextModeSupport = { + valueSet = { + 1, -- asIs + 2, -- adjustIndentation + } + }, + labelDetailsSupport = true, + }, + contextSupport = true, + insertTextMode = 1, + completionList = { + itemDefaults = { + 'commitCharacters', + 'editRange', + 'insertTextFormat', + 'insertTextMode', + 'data', + } + } + }, + }, + } + ''} ''; }; };