mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-02 21:34:33 +02:00
plugins/lsp: deprecate installLanguageServer option in favor of setting package = null
This commit is contained in:
parent
5a744a7006
commit
183eac72a9
3 changed files with 144 additions and 68 deletions
|
@ -19,80 +19,68 @@
|
|||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.lsp.servers.${name};
|
||||
|
||||
packageOption =
|
||||
if package != null
|
||||
then {
|
||||
package = mkOption {
|
||||
default = package;
|
||||
type = types.package;
|
||||
};
|
||||
}
|
||||
else {};
|
||||
in {
|
||||
options = {
|
||||
plugins.lsp.servers.${name} =
|
||||
{
|
||||
enable = mkEnableOption description;
|
||||
plugins.lsp.servers.${name} = {
|
||||
enable = mkEnableOption description;
|
||||
|
||||
installLanguageServer = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Whether nixvim should take care of installing the language server.";
|
||||
};
|
||||
package = mkOption {
|
||||
default = package;
|
||||
type = types.nullOr types.package;
|
||||
description = "Which package to use for ${name}.";
|
||||
};
|
||||
|
||||
cmd = mkOption {
|
||||
type = with types; nullOr (listOf str);
|
||||
default =
|
||||
if cfg.installLanguageServer
|
||||
then cmd cfg
|
||||
else null;
|
||||
};
|
||||
cmd = mkOption {
|
||||
type = with types; nullOr (listOf str);
|
||||
default =
|
||||
if (cfg.package or null) != null
|
||||
then cmd cfg
|
||||
else null;
|
||||
};
|
||||
|
||||
filetypes = helpers.mkNullOrOption (types.listOf types.str) ''
|
||||
Set of filetypes for which to attempt to resolve {root_dir}.
|
||||
May be empty, or server may specify a default value.
|
||||
'';
|
||||
filetypes = helpers.mkNullOrOption (types.listOf types.str) ''
|
||||
Set of filetypes for which to attempt to resolve {root_dir}.
|
||||
May be empty, or server may specify a default value.
|
||||
'';
|
||||
|
||||
autostart = helpers.defaultNullOpts.mkBool true ''
|
||||
Controls if the `FileType` autocommand that launches a language server is created.
|
||||
If `false`, allows for deferring language servers until manually launched with
|
||||
`:LspStart` (|lspconfig-commands|).
|
||||
'';
|
||||
autostart = helpers.defaultNullOpts.mkBool true ''
|
||||
Controls if the `FileType` autocommand that launches a language server is created.
|
||||
If `false`, allows for deferring language servers until manually launched with
|
||||
`:LspStart` (|lspconfig-commands|).
|
||||
'';
|
||||
|
||||
rootDir = helpers.defaultNullOpts.mkLuaFn "nil" ''
|
||||
A function (or function handle) which returns the root of the project used to
|
||||
determine if lspconfig should launch a new language server, or attach a previously
|
||||
launched server when you open a new buffer matching the filetype of the server.
|
||||
'';
|
||||
rootDir = helpers.defaultNullOpts.mkLuaFn "nil" ''
|
||||
A function (or function handle) which returns the root of the project used to
|
||||
determine if lspconfig should launch a new language server, or attach a previously
|
||||
launched server when you open a new buffer matching the filetype of the server.
|
||||
'';
|
||||
|
||||
onAttach =
|
||||
helpers.mkCompositeOption "Server specific on_attach behavior."
|
||||
{
|
||||
override = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Override the global `plugins.lsp.onAttach` function.";
|
||||
};
|
||||
|
||||
function = mkOption {
|
||||
type = types.lines;
|
||||
description = ''
|
||||
Body of the on_attach function.
|
||||
The argument `client` and `bufnr` is provided.
|
||||
'';
|
||||
};
|
||||
onAttach =
|
||||
helpers.mkCompositeOption "Server specific on_attach behavior."
|
||||
{
|
||||
override = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Override the global `plugins.lsp.onAttach` function.";
|
||||
};
|
||||
|
||||
settings = settingsOptions;
|
||||
|
||||
extraOptions = mkOption {
|
||||
default = {};
|
||||
type = types.attrs;
|
||||
description = "Extra options for the ${name} language server.";
|
||||
function = mkOption {
|
||||
type = types.lines;
|
||||
description = ''
|
||||
Body of the on_attach function.
|
||||
The argument `client` and `bufnr` is provided.
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
// packageOption;
|
||||
|
||||
settings = settingsOptions;
|
||||
|
||||
extraOptions = mkOption {
|
||||
default = {};
|
||||
type = types.attrs;
|
||||
description = "Extra options for the ${name} language server.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
|
@ -100,7 +88,7 @@
|
|||
{
|
||||
extraPackages =
|
||||
optional
|
||||
(cfg.installLanguageServer && (package != null))
|
||||
(cfg.package != null)
|
||||
cfg.package;
|
||||
|
||||
plugins.lsp.enabledServers = [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue