mirror of
https://github.com/nix-community/nixvim.git
synced 2025-11-08 11:36:07 +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 = { };
|
||||
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
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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" ])
|
||||
];
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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" ];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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`."
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue