From 13c3026362688b473fbf89b9d732730d23e1ae07 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Tue, 19 Sep 2023 00:40:09 +0200 Subject: [PATCH] feat: make typescript lsp install optional --- modules/languages/ts.nix | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/modules/languages/ts.nix b/modules/languages/ts.nix index 2d651ede..8902f664 100644 --- a/modules/languages/ts.nix +++ b/modules/languages/ts.nix @@ -16,7 +16,11 @@ with builtins; let lspconfig.tsserver.setup { capabilities = capabilities; on_attach = attach_keymaps, - cmd = { "${cfg.lsp.package}/bin/typescript-language-server", "--stdio" } + cmd = ${ + if isList cfg.lsp.package + then nvim.lua.expToLua cfg.lsp.package + else ''{"${cfg.lsp.package}/bin/typescript-language-server", "--stdio"}'' + } } ''; }; @@ -27,7 +31,11 @@ with builtins; let lspconfig.denols.setup { capabilities = capabilities; on_attach = attach_keymaps, - cmd = { "${cfg.lsp.package}/bin/deno", "lsp" } + cmd = ${ + if isList cfg.lsp.package + then nvim.lua.expToLua cfg.lsp.package + else ''{"${cfg.lsp.package}/bin/deno", "lsp"}'' + } } ''; }; @@ -96,7 +104,7 @@ in { package = mkOption { description = "Typescript/Javascript LSP server package"; - type = types.package; + type = with types; either package (listOf str); default = servers.${cfg.lsp.server}.package; }; };