From cf3f10265b83f3115d6aea5ec43e4f981c9be537 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=A9tan=20Lepage?= <33058747+GaetanLepage@users.noreply.github.com> Date: Tue, 14 Mar 2023 15:16:26 +0100 Subject: [PATCH] plugins/nvim-lsp: add filetypes and autostart options for LS (#252) --- plugins/nvim-lsp/helpers.nix | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/plugins/nvim-lsp/helpers.nix b/plugins/nvim-lsp/helpers.nix index fb0040f7..a48b6e51 100644 --- a/plugins/nvim-lsp/helpers.nix +++ b/plugins/nvim-lsp/helpers.nix @@ -24,6 +24,7 @@ }: with lib; let cfg = config.plugins.lsp.servers.${name}; + helpers = import ../helpers.nix {inherit lib;}; packageOption = if package != null @@ -39,11 +40,25 @@ plugins.lsp.servers.${name} = { enable = mkEnableOption description; + cmd = mkOption { type = with types; nullOr (listOf str); default = cmd cfg; }; + + filetypes = helpers.mkNullOrOption (types.listOf types.str) '' + Set of filetypes for which to attempt to resolve {root_dir}. + May be empty, or server may specify a default value. + ''; + + autostart = helpers.defaultNullOpts.mkBool true '' + Controls if the `FileType` autocommand that launches a language server is created. + If `false`, allows for deferring language servers until manually launched with + `:LspStart` (|lspconfig-commands|). + ''; + settings = settingsOptions; + extraSettings = mkOption { default = {}; type = types.attrs; @@ -66,7 +81,7 @@ { name = serverName; extraOptions = { - cmd = cfg.cmd; + inherit (cfg) cmd filetypes autostart; settings = settings (cfg.settings // cfg.extraSettings); }; }