feat: make dart lsp install optional

This commit is contained in:
Ching Pei Yang 2023-09-19 01:26:41 +02:00
parent 35e86d1f12
commit ed09cb7ed6
2 changed files with 11 additions and 3 deletions

View file

@ -15,7 +15,11 @@ with builtins; let
lspconfig.dartls.setup{ lspconfig.dartls.setup{
capabilities = capabilities; capabilities = capabilities;
on_attach=default_on_attach; on_attach=default_on_attach;
cmd = {"${pkgs.dart}/bin/dart", "language-server", "--protocol=lsp"}; cmd = ${
if isList cfg.lsp.package
then nvim.lua.expToLua cfg.lsp.package
else ''{"${cfg.lsp.package}/bin/dart", "language-server", "--protocol=lsp"}''
};
${optionalString (cfg.lsp.opts != null) "init_options = ${cfg.lsp.dartOpts}"} ${optionalString (cfg.lsp.opts != null) "init_options = ${cfg.lsp.dartOpts}"}
} }
''; '';

View file

@ -15,7 +15,11 @@ with builtins; let
lspconfig.dartls.setup{ lspconfig.dartls.setup{
capabilities = capabilities; capabilities = capabilities;
on_attach=default_on_attach; on_attach=default_on_attach;
cmd = {"${pkgs.dart}/bin/dart", "language-server", "--protocol=lsp"}; cmd = ${
if isList cfg.lsp.package
then nvim.lua.expToLua cfg.lsp.package
else ''{"${cfg.lsp.package}/bin/dart", "language-server", "--protocol=lsp"}''
};
${optionalString (cfg.lsp.opts != null) "init_options = ${cfg.lsp.dartOpts}"} ${optionalString (cfg.lsp.opts != null) "init_options = ${cfg.lsp.dartOpts}"}
} }
''; '';
@ -39,7 +43,7 @@ in {
}; };
package = mkOption { package = mkOption {
description = "Dart LSP server package"; description = "Dart 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;
}; };
opts = mkOption { opts = mkOption {