nvim-lsp/pylsp: fix regressions introduced in #213 (#231)

This commit is contained in:
Gaétan Lepage 2023-03-10 03:58:29 +01:00 committed by GitHub
parent ecfa870c7a
commit 1a110b71d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,27 +24,23 @@ in {
); );
}; };
plugins = { plugins = helpers.mkCompositeOption "pylsp plugins" {
autopep8 = { autopep8 = helpers.mkCompositeOption "autopep8 settings" {
enabled = mkOption { enabled = helpers.defaultNullOpts.mkBool true ''
type = types.bool; Enable or disable the plugin.
description = '' Setting this explicitely to `true` will install the dependency for this plugin (autopep8).
Enable or disable the plugin (disabling required to use `yapf`). '';
'';
default = true;
};
}; };
flake8 = { flake8 = helpers.mkCompositeOption "flake8 settings" {
config = helpers.mkNullOrOption types.str '' config = helpers.mkNullOrOption types.str ''
Path to the config file that will be the authoritative config source. Path to the config file that will be the authoritative config source.
''; '';
enabled = mkOption { enabled = helpers.defaultNullOpts.mkBool false ''
type = types.bool; Enable or disable the plugin.
description = "Enable or disable the plugin."; Setting this explicitely to `true` will install the dependency for this plugin (flake8).
default = false; '';
};
exclude = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" '' exclude = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" ''
List of files or directories to exclude. List of files or directories to exclude.
@ -90,7 +86,7 @@ in {
''; '';
}; };
jedi = { jedi = helpers.mkCompositeOption "jedi settings" {
auto_import_modules = auto_import_modules =
helpers.defaultNullOpts.mkNullable helpers.defaultNullOpts.mkNullable
(types.listOf types.str) (types.listOf types.str)
@ -106,12 +102,8 @@ in {
''; '';
}; };
jedi_completion = { jedi_completion = helpers.mkCompositeOption "jedi_completion settings" {
enabled = mkOption { enabled = helpers.defaultNullOpts.mkBool true "Enable or disable the plugin.";
type = types.bool;
description = "Enable or disable the plugin.";
default = true;
};
include_params = helpers.defaultNullOpts.mkBool true '' include_params = helpers.defaultNullOpts.mkBool true ''
Auto-completes methods and classes with tabstops for each parameter. Auto-completes methods and classes with tabstops for each parameter.
@ -144,12 +136,8 @@ in {
"Modules for which labels and snippets should be cached."; "Modules for which labels and snippets should be cached.";
}; };
jedi_definition = { jedi_definition = helpers.mkCompositeOption "jedi_definition settings" {
enabled = mkOption { enabled = helpers.defaultNullOpts.mkBool true "Enable or disable the plugin.";
type = types.bool;
description = "Enable or disable the plugin.";
default = true;
};
follow_imports = helpers.defaultNullOpts.mkBool true '' follow_imports = helpers.defaultNullOpts.mkBool true ''
The goto call will follow imports. The goto call will follow imports.
@ -164,36 +152,20 @@ in {
''; '';
}; };
jedi_hover = { jedi_hover = helpers.mkCompositeOption "jedi_hover settings" {
enabled = mkOption { enabled = helpers.defaultNullOpts.mkBool true "Enable or disable the plugin.";
type = types.bool;
description = "Enable or disable the plugin.";
default = true;
};
}; };
jedi_references = { jedi_references = helpers.mkCompositeOption "jedi_references settings" {
enabled = mkOption { enabled = helpers.defaultNullOpts.mkBool true "Enable or disable the plugin.";
type = types.bool;
description = "Enable or disable the plugin.";
default = true;
};
}; };
jedi_signature_help = { jedi_signature_help = helpers.mkCompositeOption "jedi_signature_help settings" {
enabled = mkOption { enabled = helpers.defaultNullOpts.mkBool true "Enable or disable the plugin.";
type = types.bool;
description = "Enable or disable the plugin.";
default = true;
};
}; };
jedi_symbols = { jedi_symbols = helpers.mkCompositeOption "jedi_symbols settings" {
enabled = mkOption { enabled = helpers.defaultNullOpts.mkBool true "Enable or disable the plugin.";
type = types.bool;
description = "Enable or disable the plugin.";
default = true;
};
all_scopes = helpers.defaultNullOpts.mkBool true '' all_scopes = helpers.defaultNullOpts.mkBool true ''
If true lists the names of all scopes instead of only the module namespace. If true lists the names of all scopes instead of only the module namespace.
@ -204,36 +176,31 @@ in {
''; '';
}; };
mccabe = { mccabe = helpers.mkCompositeOption "mccabe settings" {
enabled = mkOption { enabled = helpers.defaultNullOpts.mkBool true ''
type = types.bool; Enable or disable the plugin.
description = "Enable or disable the plugin."; Setting this explicitely to `true` will install the dependency for this plugin (mccabe).
default = true; '';
};
threshold = helpers.defaultNullOpts.mkInt 15 '' threshold = helpers.defaultNullOpts.mkInt 15 ''
The minimum threshold that triggers warnings about cyclomatic complexity. The minimum threshold that triggers warnings about cyclomatic complexity.
''; '';
}; };
preload = { preload = helpers.mkCompositeOption "preload settings" {
enabled = mkOption { enabled = helpers.defaultNullOpts.mkBool true "Enable or disable the plugin.";
type = types.bool;
description = "Enable or disable the plugin.";
default = true;
};
modules = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" '' modules = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" ''
List of modules to import on startup. List of modules to import on startup.
''; '';
}; };
pycodestyle = { pycodestyle = helpers.mkCompositeOption "pycodestyle settings" {
enabled = mkOption { enabled = helpers.defaultNullOpts.mkBool true ''
type = types.bool; Enable or disable the plugin.
description = "Enable or disable the plugin."; Setting this explicitely to `true` will install the dependency for this plugin
default = true; (pycodestyle).
}; '';
exclude = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" '' exclude = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" ''
Exclude files or directories which match these patterns. Exclude files or directories which match these patterns.
@ -264,12 +231,12 @@ in {
''; '';
}; };
pydocstyle = { pydocstyle = helpers.mkCompositeOption "pydocstyle settings" {
enabled = mkOption { enabled = helpers.defaultNullOpts.mkBool false ''
type = types.bool; Enable or disable the plugin.
description = "Enable or disable the plugin."; Setting this explicitely to `true` will install the dependency for this plugin
default = false; (pydocstyle).
}; '';
convention = convention =
helpers.mkNullOrOption helpers.mkNullOrOption
@ -308,20 +275,18 @@ in {
''; '';
}; };
pyflakes = { pyflakes = helpers.mkCompositeOption "pyflakes settings" {
enabled = mkOption { enabled = helpers.defaultNullOpts.mkBool true ''
type = types.bool; Enable or disable the plugin.
description = "Enable or disable the plugin."; Setting this explicitely to `true` will install the dependency for this plugin (pyflakes).
default = true; '';
};
}; };
pylint = { pylint = helpers.mkCompositeOption "pylint settings" {
enabled = mkOption { enabled = helpers.defaultNullOpts.mkBool false ''
type = types.bool; Enable or disable the plugin.
description = "Enable or disable the plugin."; Setting this explicitely to `true` will install the dependency for this plugin (pylint).
default = false; '';
};
args = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" '' args = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" ''
Arguments to pass to pylint. Arguments to pass to pylint.
@ -334,12 +299,11 @@ in {
''; '';
}; };
rope_autoimport = { rope_autoimport = helpers.mkCompositeOption "rope_autoimport settings" {
enabled = mkOption { enabled = helpers.defaultNullOpts.mkBool false ''
type = types.bool; Enable or disable the plugin.
description = "Enable or disable autoimport."; Setting this explicitely to `true` will install the dependency for this plugin (rope).
default = false; '';
};
memory = helpers.defaultNullOpts.mkBool false '' memory = helpers.defaultNullOpts.mkBool false ''
Make the autoimport database memory only. Make the autoimport database memory only.
@ -347,33 +311,31 @@ in {
''; '';
}; };
rope_completion = { rope_completion = helpers.mkCompositeOption "rope_completion settings" {
enabled = mkOption { enabled = helpers.defaultNullOpts.mkBool false ''
type = types.bool; Enable or disable the plugin.
description = "Enable or disable the plugin."; Setting this explicitely to `true` will install the dependency for this plugin (rope).
default = false; '';
};
eager = helpers.defaultNullOpts.mkBool false '' eager = helpers.defaultNullOpts.mkBool false ''
Resolve documentation and detail eagerly. Resolve documentation and detail eagerly.
''; '';
}; };
yapf = { yapf = helpers.mkCompositeOption "yapf settings" {
enabled = mkOption { enabled = helpers.defaultNullOpts.mkBool true ''
type = types.bool; Enable or disable the plugin.
description = "Enable or disable the plugin."; Setting this explicitely to `true` will install the dependency for this plugin (yapf).
default = true; '';
};
}; };
### THIRD-PARTY PLUGINS ### THIRD-PARTY PLUGINS
pylsp_mypy = { pylsp_mypy = helpers.mkCompositeOption "pylsp_mypy settings" {
enabled = mkOption { enabled = helpers.defaultNullOpts.mkBool false ''
type = types.bool; Enable or disable the plugin.
description = "Enable or disable the plugin."; Setting this explicitely to `true` will install the dependency for this plugin
default = false; (pylsp-mypy).
}; '';
live_mode = helpers.defaultNullOpts.mkBool true '' live_mode = helpers.defaultNullOpts.mkBool true ''
Provides type checking as you type. Provides type checking as you type.
@ -432,7 +394,7 @@ in {
### END OF THIRD-PARTY PLUGINS ### END OF THIRD-PARTY PLUGINS
}; };
rope = { rope = helpers.mkCompositeOption "rope settings" {
extensionModules = helpers.mkNullOrOption types.str '' extensionModules = helpers.mkNullOrOption types.str ''
Builtin and c-extension modules that are allowed to be imported and inspected by rope. Builtin and c-extension modules that are allowed to be imported and inspected by rope.
''; '';
@ -447,11 +409,13 @@ in {
config = config =
mkIf cfg.enable mkIf cfg.enable
{ {
extraPackages = with cfg.settings; extraPackages = with cfg.settings; let
isNotNullAndEnabled = x: (!isNull x) && x.enabled;
in
lists.flatten (map lists.flatten (map
( (
pluginName: ( pluginName: (
optionals plugins.${pluginName}.enabled optionals (isNotNullAndEnabled plugins.${pluginName})
cfg.package.optional-dependencies.${pluginName} cfg.package.optional-dependencies.${pluginName}
) )
) )
@ -467,9 +431,15 @@ in {
]) ])
++ ( ++ (
optionals optionals
(plugins.rope_autoimport.enabled || plugins.rope_completion.enabled) (
(isNotNullAndEnabled plugins.rope_autoimport)
|| (isNotNullAndEnabled plugins.rope_completion)
)
cfg.package.optional-dependencies.rope cfg.package.optional-dependencies.rope
) )
++ (optional plugins.pylsp_mypy.enabled pkgs.python3Packages.pylsp-mypy); ++ (
optional (isNotNullAndEnabled plugins.pylsp_mypy)
pkgs.python3Packages.pylsp-mypy
);
}; };
} }