From a0399722a0d39fc230f27711e743cf434dd0ca0e Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Fri, 15 Sep 2023 00:17:12 +0200 Subject: [PATCH] feat: make java lsp install optional --- modules/languages/java.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/languages/java.nix b/modules/languages/java.nix index 1792824f..f0906114 100644 --- a/modules/languages/java.nix +++ b/modules/languages/java.nix @@ -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"}'' + }, } ''; })