diff --git a/modules/lsp/servers/default.nix b/modules/lsp/servers/default.nix index 8223b421..ead07f04 100644 --- a/modules/lsp/servers/default.nix +++ b/modules/lsp/servers/default.nix @@ -103,7 +103,7 @@ in ''; default = { }; example = { - "*".settings = { + "*".config = { root_markers = [ ".git" ]; capabilities.textDocument.semanticTokens = { multilineTokenSupport = true; @@ -112,7 +112,7 @@ in lua_ls.enable = true; clangd = { enable = true; - settings = { + config = { cmd = [ "clangd" "--background-index" @@ -161,11 +161,11 @@ in server: let luaName = toLuaObject server.name; - luaSettings = toLuaObject server.settings; - wrap = server.__settingsWrapper or lib.id; + luaConfig = toLuaObject server.config; + wrap = server.__configWrapper or lib.id; in [ - (lib.mkIf (server.settings != { }) "vim.lsp.config(${luaName}, ${wrap luaSettings})") + (lib.mkIf (server.config != { }) "vim.lsp.config(${luaName}, ${wrap luaConfig})") (lib.mkIf (server.activate or false) "vim.lsp.enable(${luaName})") ]; in @@ -182,13 +182,13 @@ in local __setup = ${lib.foldr lib.id "{ capabilities = __lspCapabilities() }" oldCfg.setupWrappers} - local __wrapSettings = function(settings) - if settings == nil then - settings = __setup + local __wrapConfig = function(cfg) + if cfg == nil then + cfg = __setup else - settings = vim.tbl_extend("keep", settings, __setup) + cfg = vim.tbl_extend("keep", cfg, __setup) end - return settings + return cfg end '' ++ builtins.concatMap mkServerConfig enabledServers diff --git a/modules/lsp/servers/global-server.nix b/modules/lsp/servers/global-server.nix index 5b64ad45..a75922d0 100644 --- a/modules/lsp/servers/global-server.nix +++ b/modules/lsp/servers/global-server.nix @@ -23,7 +23,7 @@ in readOnly = true; }; - settings = lib.mkOption { + config = lib.mkOption { type = with types; attrsOf anything; description = '' Default configuration shared by all servers. diff --git a/modules/lsp/servers/server-renames.nix b/modules/lsp/servers/server-renames.nix index e97c0332..1e5e0fe0 100644 --- a/modules/lsp/servers/server-renames.nix +++ b/modules/lsp/servers/server-renames.nix @@ -11,11 +11,12 @@ }; imports = [ - # TODO: rename added 2025-04-30 (during the 25.05 cycle) - # The previous name `config` was introduced 2025-04-28 (during the 25.05 cycle) - # Because the previous name `config` never made it into a stable release, - # we could consider dropping this alias sooner than normal. - (lib.mkRenamedOptionModule [ "config" ] [ "settings" ]) + # 2025-05-28: Introduced the option, named `config` + # 2025-04-30: Renamed `config` → `settings` + # 25.05 released 🚀 + # 2025-10-03: Renamed `settings` → `config` 🙈 + # See RFC: https://github.com/nix-community/nixvim/issues/3745 + (lib.mkRenamedOptionModule [ "settings" ] [ "config" ]) ]; } diff --git a/modules/lsp/servers/server.nix b/modules/lsp/servers/server.nix index a4800964..be7e4776 100644 --- a/modules/lsp/servers/server.nix +++ b/modules/lsp/servers/server.nix @@ -2,7 +2,7 @@ { name ? "the language server", package ? null, - settings ? null, + config ? null, pkgs ? { }, }@args: { @@ -64,14 +64,14 @@ in ''; }; - settings = lib.mkOption { + config = lib.mkOption { type = with types; attrsOf anything; description = '' - Configurations for ${displayName}. ${settings.extraDescription or ""} + Configurations for ${displayName}. ${args.config.extraDescription or ""} ''; default = { }; example = - settings.example or { + args.config.example or { cmd = [ "clangd" "--background-index" diff --git a/plugins/by-name/clangd-extensions/default.nix b/plugins/by-name/clangd-extensions/default.nix index f30ec630..aa131861 100644 --- a/plugins/by-name/clangd-extensions/default.nix +++ b/plugins/by-name/clangd-extensions/default.nix @@ -85,7 +85,7 @@ lib.nixvim.plugins.mkNeovimPlugin { lsp = { servers.clangd = { - settings = lib.mkIf cfg.enableOffsetEncodingWorkaround { + config = lib.mkIf cfg.enableOffsetEncodingWorkaround { capabilities = { offsetEncoding = [ "utf-16" ]; }; diff --git a/plugins/by-name/schemastore/default.nix b/plugins/by-name/schemastore/default.nix index 6a776b87..96a7770c 100644 --- a/plugins/by-name/schemastore/default.nix +++ b/plugins/by-name/schemastore/default.nix @@ -172,7 +172,7 @@ lib.nixvim.plugins.mkVimPlugin { }; lsp.servers = { - jsonls.settings.settings = mkIf cfg.json.enable { + jsonls.config.settings = mkIf cfg.json.enable { schemas.__raw = '' require('schemastore').json.schemas(${lib.nixvim.toLuaObject cfg.json.settings}) ''; @@ -182,7 +182,7 @@ lib.nixvim.plugins.mkVimPlugin { validate.enable = mkDefault true; }; - yamlls.settings.settings = mkIf cfg.yaml.enable { + yamlls.config.settings = mkIf cfg.yaml.enable { schemaStore = { # From the README: "You must disable built-in schemaStore support if you want to use # this plugin and its advanced options like `ignore`." diff --git a/plugins/lsp/language-servers/_mk-lsp.nix b/plugins/lsp/language-servers/_mk-lsp.nix index 738d7f62..f30d71f3 100644 --- a/plugins/lsp/language-servers/_mk-lsp.nix +++ b/plugins/lsp/language-servers/_mk-lsp.nix @@ -196,7 +196,7 @@ in lsp.servers.${serverName} = _: { # Top-secret internal option that only exists when the server is enabled via the old API. # The new API checks if this attr exists and uses it to wrap the server's settings string. - options.__settingsWrapper = lib.mkOption { + options.__configWrapper = lib.mkOption { type = lib.types.functionTo lib.types.str; description = '' This internal option exists to preserve the old `plugins.lsp` behaviour. @@ -217,9 +217,9 @@ in lib.modules.mkAliasAndWrapDefsWithPriority lib.id opts.package ); packageFallback = lib.modules.mkAliasAndWrapDefsWithPriority lib.id opts.packageFallback; - __settingsWrapper = - settings: "__wrapSettings(${lib.foldr lib.id settings config.plugins.lsp.setupWrappers})"; - settings = { + __configWrapper = + luaCfg: "__wrapConfig(${lib.foldr lib.id luaCfg config.plugins.lsp.setupWrappers})"; + config = { autostart = lib.mkIf (cfg.autostart != null) cfg.autostart; cmd = lib.mkIf (cfg.cmd != null) cfg.cmd; filetypes = lib.mkIf (cfg.filetypes != null) cfg.filetypes; diff --git a/tests/test-sources/modules/lsp.nix b/tests/test-sources/modules/lsp.nix index 93a44c0b..e2a959a6 100644 --- a/tests/test-sources/modules/lsp.nix +++ b/tests/test-sources/modules/lsp.nix @@ -1,7 +1,7 @@ { example = { lsp.servers = { - "*".settings = { + "*".config = { enable = true; root_markers = [ ".git" ]; capabilities.textDocument.semanticTokens = { @@ -11,7 +11,7 @@ luals.enable = true; clangd = { enable = true; - settings = { + config = { cmd = [ "clangd" "--background-index"