mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-22 08:53:28 +02:00
plugins/nvim-lsp: add extraOptions for nvim-lsp language servers (#351)
This commit is contained in:
parent
7f36532bdb
commit
3014192cdc
2 changed files with 40 additions and 14 deletions
|
@ -20,6 +20,7 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
|
options,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib; let
|
with lib; let
|
||||||
|
@ -84,6 +85,12 @@
|
||||||
Extra settings for the ${name} language server.
|
Extra settings for the ${name} language server.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extraOptions = mkOption {
|
||||||
|
default = {};
|
||||||
|
type = types.attrs;
|
||||||
|
description = "Extra options for the ${name} language server.";
|
||||||
|
};
|
||||||
}
|
}
|
||||||
// packageOption;
|
// packageOption;
|
||||||
};
|
};
|
||||||
|
@ -98,7 +105,8 @@
|
||||||
plugins.lsp.enabledServers = [
|
plugins.lsp.enabledServers = [
|
||||||
{
|
{
|
||||||
name = serverName;
|
name = serverName;
|
||||||
extraOptions = {
|
extraOptions =
|
||||||
|
{
|
||||||
inherit (cfg) cmd filetypes autostart;
|
inherit (cfg) cmd filetypes autostart;
|
||||||
on_attach =
|
on_attach =
|
||||||
helpers.ifNonNull' cfg.onAttach
|
helpers.ifNonNull' cfg.onAttach
|
||||||
|
@ -111,9 +119,21 @@
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
settings = (settings cfg.settings) // cfg.extraSettings;
|
settings = (settings cfg.settings) // cfg.extraSettings;
|
||||||
};
|
}
|
||||||
|
// cfg.extraOptions;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
warnings = let
|
||||||
|
extraSettingsOption = options.plugins.lsp.servers.${name}.extraSettings;
|
||||||
|
in
|
||||||
|
optional
|
||||||
|
(extraSettingsOption.isDefined)
|
||||||
|
(
|
||||||
|
let
|
||||||
|
optionPrefix = "plugins.lsp.servers.${name}";
|
||||||
|
in "The `${optionPrefix}.extraSettings` option is deprecated in favor of `${optionPrefix}.extraOptions.settings`."
|
||||||
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,12 @@
|
||||||
};
|
};
|
||||||
nil_ls.enable = true;
|
nil_ls.enable = true;
|
||||||
rust-analyzer.enable = true;
|
rust-analyzer.enable = true;
|
||||||
|
ruff-lsp = {
|
||||||
|
enable = true;
|
||||||
|
extraOptions = {
|
||||||
|
init_options.settings.args = ["--config=/path/to/config.toml"];
|
||||||
|
};
|
||||||
|
};
|
||||||
pylsp = {
|
pylsp = {
|
||||||
enable = true;
|
enable = true;
|
||||||
filetypes = ["python"];
|
filetypes = ["python"];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue