1
0
Fork 0
mirror of https://github.com/nix-community/nixvim.git synced 2025-12-20 07:51:12 +01:00

modules/lsp: rename server settingsconfig

See RFC: https://github.com/nix-community/nixvim/issues/3745

This effectively reverts 21688b1d2a
This commit is contained in:
Matt Sturgeon 2025-10-03 20:07:13 +01:00
parent 57006a3ace
commit 9f336d2d71
8 changed files with 30 additions and 29 deletions

View file

@ -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

View file

@ -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.

View file

@ -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" ])
];
}

View file

@ -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"