From 05e39f3f925b62f4032bd09980fed4af60a0705d Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Sun, 6 Apr 2025 00:23:46 +0200 Subject: [PATCH] fixup! lib/languages: add explicit enable to LSP submodule --- lib/languages.nix | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/lib/languages.nix b/lib/languages.nix index 24a37856..c4074144 100644 --- a/lib/languages.nix +++ b/lib/languages.nix @@ -1,11 +1,11 @@ {lib}: let inherit (builtins) isString getAttr; inherit (lib.options) mkOption; - inherit (lib.types) listOf bool str submodule; - inherit (lib.generators) mkLuaInline; + inherit (lib.types) listOf bool str submodule attrsOf anything either nullOr; inherit (lib.nvim.attrsets) mapListToAttrs; inherit (lib.nvim.types) luaInline; in { + # TODO: remove diagnosticsToLua = { lang, config, @@ -35,6 +35,7 @@ in { }; lspOptions = submodule { + freeformType = attrsOf anything; options = { enable = mkOption { type = bool; @@ -43,29 +44,32 @@ in { }; capabilities = mkOption { - type = luaInline; - default = mkLuaInline "capabilities"; + type = nullOr (either luaInline (attrsOf anything)); + default = null; description = "LSP capabilitiess to pass to lspconfig"; }; on_attach = mkOption { - type = luaInline; - default = mkLuaInline "default_on_attach"; + type = nullOr luaInline; + default = null; description = "Function to execute when an LSP server attaches to a buffer"; }; filetypes = mkOption { - type = listOf str; + type = nullOr (listOf str); + default = null; description = "Filetypes to auto-attach LSP in"; }; cmd = mkOption { - type = listOf str; + type = nullOr (listOf str); + default = null; description = "Command used to start the LSP server"; }; root_markers = mkOption { - type = listOf str; + type = nullOr (listOf str); + default = null; description = '' "root markers" used to determine the root directory of the workspace, and the filetypes associated with this LSP server.