mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
nvim-lsp: added nvim-cmp completion capabilities (#158)
Co-authored-by: Pedro Alves <pta2002@pta2002.com>
This commit is contained in:
parent
60faa3cf93
commit
bb3721e92d
3 changed files with 26 additions and 2 deletions
|
@ -453,6 +453,14 @@ in {
|
||||||
})
|
})
|
||||||
known_source_names);
|
known_source_names);
|
||||||
in
|
in
|
||||||
mkIf cfg.auto_enable_sources attrs_enabled;
|
mkMerge [
|
||||||
|
(mkIf cfg.auto_enable_sources attrs_enabled)
|
||||||
|
(mkIf (elem "nvim_lsp" found_sources)
|
||||||
|
{
|
||||||
|
lsp.capabilities = ''
|
||||||
|
capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
./git/gitmessenger.nix
|
./git/gitmessenger.nix
|
||||||
./git/gitsigns.nix
|
./git/gitsigns.nix
|
||||||
./git/neogit.nix
|
./git/neogit.nix
|
||||||
|
|
||||||
./languages/clangd-extensions.nix
|
./languages/clangd-extensions.nix
|
||||||
./languages/ledger.nix
|
./languages/ledger.nix
|
||||||
./languages/markdown-preview.nix
|
./languages/markdown-preview.nix
|
||||||
|
|
|
@ -44,6 +44,12 @@ in {
|
||||||
default = "";
|
default = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
capabilities = mkOption {
|
||||||
|
type = types.lines;
|
||||||
|
description = "Lua code that modifies inplace the `capabilities` table.";
|
||||||
|
default = "";
|
||||||
|
};
|
||||||
|
|
||||||
setupWrappers = mkOption {
|
setupWrappers = mkOption {
|
||||||
type = with types; listOf (functionTo str);
|
type = with types; listOf (functionTo str);
|
||||||
description = "Code to be run to wrap the setup args. Takes in an argument containing the previous results, and returns a new string of code.";
|
description = "Code to be run to wrap the setup args. Takes in an argument containing the previous results, and returns a new string of code.";
|
||||||
|
@ -78,13 +84,22 @@ in {
|
||||||
-- LSP {{{
|
-- LSP {{{
|
||||||
do
|
do
|
||||||
${cfg.preConfig}
|
${cfg.preConfig}
|
||||||
|
|
||||||
local __lspServers = ${helpers.toLuaObject cfg.enabledServers}
|
local __lspServers = ${helpers.toLuaObject cfg.enabledServers}
|
||||||
local __lspOnAttach = function(client, bufnr)
|
local __lspOnAttach = function(client, bufnr)
|
||||||
${cfg.onAttach}
|
${cfg.onAttach}
|
||||||
end
|
end
|
||||||
|
local __lspCapabilities = function()
|
||||||
|
capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
|
|
||||||
|
${cfg.capabilities}
|
||||||
|
|
||||||
|
return capabilities
|
||||||
|
end
|
||||||
|
|
||||||
local __setup = ${runWrappers cfg.setupWrappers "{
|
local __setup = ${runWrappers cfg.setupWrappers "{
|
||||||
on_attach = __lspOnAttach
|
on_attach = __lspOnAttach,
|
||||||
|
capabilities = __lspCapabilities()
|
||||||
}"}
|
}"}
|
||||||
|
|
||||||
for i,server in ipairs(__lspServers) do
|
for i,server in ipairs(__lspServers) do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue