diff --git a/plugins/lsp/helpers.nix b/plugins/lsp/helpers.nix index b6b6c6c4..402fe068 100644 --- a/plugins/lsp/helpers.nix +++ b/plugins/lsp/helpers.nix @@ -32,7 +32,7 @@ then { package = mkOption { default = package; - type = types.nullOr types.package; + type = types.package; }; } else {}; @@ -42,9 +42,18 @@ { enable = mkEnableOption description; + installLanguageServer = mkOption { + type = types.bool; + default = true; + description = "Whether nixvim should take care of installing the language server."; + }; + cmd = mkOption { type = with types; nullOr (listOf str); - default = cmd cfg; + default = + if cfg.installLanguageServer + then cmd cfg + else null; }; filetypes = helpers.mkNullOrOption (types.listOf types.str) '' @@ -103,7 +112,7 @@ extraPackages = ( optional - ((package != null) && (cfg.package != null)) + (cfg.installLanguageServer && (package != null)) cfg.package ) ++ (mapAttrsToList (name: _: cfg."${name}Package") extraPackages); diff --git a/tests/test-sources/plugins/lsp/nvim-lsp.nix b/tests/test-sources/plugins/lsp/nvim-lsp.nix index 8db31507..f73ba5f2 100644 --- a/tests/test-sources/plugins/lsp/nvim-lsp.nix +++ b/tests/test-sources/plugins/lsp/nvim-lsp.nix @@ -34,7 +34,7 @@ # Do not install the language server using nixvim gopls = { enable = true; - package = null; + installLanguageServer = false; }; nil_ls.enable = true; rust-analyzer.enable = true;