feat: make java lsp install optional

This commit is contained in:
Ching Pei Yang 2023-09-15 00:17:12 +02:00
parent 2075211c18
commit a0399722a0

View file

@ -21,7 +21,7 @@ in {
package = mkOption {
description = "java language server";
type = types.package;
type = with types; either package (listOf str);
default = pkgs.jdt-language-server;
};
};
@ -32,7 +32,11 @@ in {
vim.lsp.lspconfig.enable = true;
vim.lsp.lspconfig.sources.jdtls = ''
lspconfig.jdtls.setup {
cmd = {"${cfg.lsp.package}/bin/jdt-language-server", "-data", vim.fn.stdpath("cache").."/jdtls/workspace"},
cmd = ${
if isList cfg.lsp.package
then nvim.lua.expToLua cfg.lsp.package
else ''{"${cfg.lsp.package}/bin/jdt-language-server", "-data", vim.fn.stdpath("cache").."/jdtls/workspace"}''
},
}
'';
})