feat: make typescript lsp install optional

This commit is contained in:
Ching Pei Yang 2023-09-19 00:40:09 +02:00
parent a0399722a0
commit 13c3026362

View file

@ -16,7 +16,11 @@ with builtins; let
lspconfig.tsserver.setup { lspconfig.tsserver.setup {
capabilities = capabilities; capabilities = capabilities;
on_attach = attach_keymaps, 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 { lspconfig.denols.setup {
capabilities = capabilities; capabilities = capabilities;
on_attach = attach_keymaps, 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 { package = mkOption {
description = "Typescript/Javascript LSP server package"; description = "Typescript/Javascript LSP server package";
type = types.package; type = with types; either package (listOf str);
default = servers.${cfg.lsp.server}.package; default = servers.${cfg.lsp.server}.package;
}; };
}; };