mirror of
https://github.com/nix-community/nixvim.git
synced 2025-11-08 19:46:06 +01:00
modules/lsp: rename server settings → config
See RFC: https://github.com/nix-community/nixvim/issues/3745
This effectively reverts 21688b1d2a
This commit is contained in:
parent
57006a3ace
commit
9f336d2d71
8 changed files with 30 additions and 29 deletions
|
|
@ -103,7 +103,7 @@ in
|
||||||
'';
|
'';
|
||||||
default = { };
|
default = { };
|
||||||
example = {
|
example = {
|
||||||
"*".settings = {
|
"*".config = {
|
||||||
root_markers = [ ".git" ];
|
root_markers = [ ".git" ];
|
||||||
capabilities.textDocument.semanticTokens = {
|
capabilities.textDocument.semanticTokens = {
|
||||||
multilineTokenSupport = true;
|
multilineTokenSupport = true;
|
||||||
|
|
@ -112,7 +112,7 @@ in
|
||||||
lua_ls.enable = true;
|
lua_ls.enable = true;
|
||||||
clangd = {
|
clangd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
config = {
|
||||||
cmd = [
|
cmd = [
|
||||||
"clangd"
|
"clangd"
|
||||||
"--background-index"
|
"--background-index"
|
||||||
|
|
@ -161,11 +161,11 @@ in
|
||||||
server:
|
server:
|
||||||
let
|
let
|
||||||
luaName = toLuaObject server.name;
|
luaName = toLuaObject server.name;
|
||||||
luaSettings = toLuaObject server.settings;
|
luaConfig = toLuaObject server.config;
|
||||||
wrap = server.__settingsWrapper or lib.id;
|
wrap = server.__configWrapper or lib.id;
|
||||||
in
|
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})")
|
(lib.mkIf (server.activate or false) "vim.lsp.enable(${luaName})")
|
||||||
];
|
];
|
||||||
in
|
in
|
||||||
|
|
@ -182,13 +182,13 @@ in
|
||||||
|
|
||||||
local __setup = ${lib.foldr lib.id "{ capabilities = __lspCapabilities() }" oldCfg.setupWrappers}
|
local __setup = ${lib.foldr lib.id "{ capabilities = __lspCapabilities() }" oldCfg.setupWrappers}
|
||||||
|
|
||||||
local __wrapSettings = function(settings)
|
local __wrapConfig = function(cfg)
|
||||||
if settings == nil then
|
if cfg == nil then
|
||||||
settings = __setup
|
cfg = __setup
|
||||||
else
|
else
|
||||||
settings = vim.tbl_extend("keep", settings, __setup)
|
cfg = vim.tbl_extend("keep", cfg, __setup)
|
||||||
end
|
end
|
||||||
return settings
|
return cfg
|
||||||
end
|
end
|
||||||
''
|
''
|
||||||
++ builtins.concatMap mkServerConfig enabledServers
|
++ builtins.concatMap mkServerConfig enabledServers
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ in
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
settings = lib.mkOption {
|
config = lib.mkOption {
|
||||||
type = with types; attrsOf anything;
|
type = with types; attrsOf anything;
|
||||||
description = ''
|
description = ''
|
||||||
Default configuration shared by all servers.
|
Default configuration shared by all servers.
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,12 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
# TODO: rename added 2025-04-30 (during the 25.05 cycle)
|
# 2025-05-28: Introduced the option, named `config`
|
||||||
# The previous name `config` was introduced 2025-04-28 (during the 25.05 cycle)
|
# 2025-04-30: Renamed `config` → `settings`
|
||||||
# Because the previous name `config` never made it into a stable release,
|
# 25.05 released 🚀
|
||||||
# we could consider dropping this alias sooner than normal.
|
# 2025-10-03: Renamed `settings` → `config` 🙈
|
||||||
(lib.mkRenamedOptionModule [ "config" ] [ "settings" ])
|
# See RFC: https://github.com/nix-community/nixvim/issues/3745
|
||||||
|
(lib.mkRenamedOptionModule [ "settings" ] [ "config" ])
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
{
|
{
|
||||||
name ? "the language server",
|
name ? "the language server",
|
||||||
package ? null,
|
package ? null,
|
||||||
settings ? null,
|
config ? null,
|
||||||
pkgs ? { },
|
pkgs ? { },
|
||||||
}@args:
|
}@args:
|
||||||
{
|
{
|
||||||
|
|
@ -64,14 +64,14 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
settings = lib.mkOption {
|
config = lib.mkOption {
|
||||||
type = with types; attrsOf anything;
|
type = with types; attrsOf anything;
|
||||||
description = ''
|
description = ''
|
||||||
Configurations for ${displayName}. ${settings.extraDescription or ""}
|
Configurations for ${displayName}. ${args.config.extraDescription or ""}
|
||||||
'';
|
'';
|
||||||
default = { };
|
default = { };
|
||||||
example =
|
example =
|
||||||
settings.example or {
|
args.config.example or {
|
||||||
cmd = [
|
cmd = [
|
||||||
"clangd"
|
"clangd"
|
||||||
"--background-index"
|
"--background-index"
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
||||||
|
|
||||||
lsp = {
|
lsp = {
|
||||||
servers.clangd = {
|
servers.clangd = {
|
||||||
settings = lib.mkIf cfg.enableOffsetEncodingWorkaround {
|
config = lib.mkIf cfg.enableOffsetEncodingWorkaround {
|
||||||
capabilities = {
|
capabilities = {
|
||||||
offsetEncoding = [ "utf-16" ];
|
offsetEncoding = [ "utf-16" ];
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,7 @@ lib.nixvim.plugins.mkVimPlugin {
|
||||||
};
|
};
|
||||||
|
|
||||||
lsp.servers = {
|
lsp.servers = {
|
||||||
jsonls.settings.settings = mkIf cfg.json.enable {
|
jsonls.config.settings = mkIf cfg.json.enable {
|
||||||
schemas.__raw = ''
|
schemas.__raw = ''
|
||||||
require('schemastore').json.schemas(${lib.nixvim.toLuaObject cfg.json.settings})
|
require('schemastore').json.schemas(${lib.nixvim.toLuaObject cfg.json.settings})
|
||||||
'';
|
'';
|
||||||
|
|
@ -182,7 +182,7 @@ lib.nixvim.plugins.mkVimPlugin {
|
||||||
validate.enable = mkDefault true;
|
validate.enable = mkDefault true;
|
||||||
};
|
};
|
||||||
|
|
||||||
yamlls.settings.settings = mkIf cfg.yaml.enable {
|
yamlls.config.settings = mkIf cfg.yaml.enable {
|
||||||
schemaStore = {
|
schemaStore = {
|
||||||
# From the README: "You must disable built-in schemaStore support if you want to use
|
# From the README: "You must disable built-in schemaStore support if you want to use
|
||||||
# this plugin and its advanced options like `ignore`."
|
# this plugin and its advanced options like `ignore`."
|
||||||
|
|
|
||||||
|
|
@ -196,7 +196,7 @@ in
|
||||||
lsp.servers.${serverName} = _: {
|
lsp.servers.${serverName} = _: {
|
||||||
# Top-secret internal option that only exists when the server is enabled via the old API.
|
# 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.
|
# 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;
|
type = lib.types.functionTo lib.types.str;
|
||||||
description = ''
|
description = ''
|
||||||
This internal option exists to preserve the old `plugins.lsp` behaviour.
|
This internal option exists to preserve the old `plugins.lsp` behaviour.
|
||||||
|
|
@ -217,9 +217,9 @@ in
|
||||||
lib.modules.mkAliasAndWrapDefsWithPriority lib.id opts.package
|
lib.modules.mkAliasAndWrapDefsWithPriority lib.id opts.package
|
||||||
);
|
);
|
||||||
packageFallback = lib.modules.mkAliasAndWrapDefsWithPriority lib.id opts.packageFallback;
|
packageFallback = lib.modules.mkAliasAndWrapDefsWithPriority lib.id opts.packageFallback;
|
||||||
__settingsWrapper =
|
__configWrapper =
|
||||||
settings: "__wrapSettings(${lib.foldr lib.id settings config.plugins.lsp.setupWrappers})";
|
luaCfg: "__wrapConfig(${lib.foldr lib.id luaCfg config.plugins.lsp.setupWrappers})";
|
||||||
settings = {
|
config = {
|
||||||
autostart = lib.mkIf (cfg.autostart != null) cfg.autostart;
|
autostart = lib.mkIf (cfg.autostart != null) cfg.autostart;
|
||||||
cmd = lib.mkIf (cfg.cmd != null) cfg.cmd;
|
cmd = lib.mkIf (cfg.cmd != null) cfg.cmd;
|
||||||
filetypes = lib.mkIf (cfg.filetypes != null) cfg.filetypes;
|
filetypes = lib.mkIf (cfg.filetypes != null) cfg.filetypes;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
example = {
|
example = {
|
||||||
lsp.servers = {
|
lsp.servers = {
|
||||||
"*".settings = {
|
"*".config = {
|
||||||
enable = true;
|
enable = true;
|
||||||
root_markers = [ ".git" ];
|
root_markers = [ ".git" ];
|
||||||
capabilities.textDocument.semanticTokens = {
|
capabilities.textDocument.semanticTokens = {
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
luals.enable = true;
|
luals.enable = true;
|
||||||
clangd = {
|
clangd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
config = {
|
||||||
cmd = [
|
cmd = [
|
||||||
"clangd"
|
"clangd"
|
||||||
"--background-index"
|
"--background-index"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue