mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
plugins/lsp/efmls-configs: cosmetic-only refactoring
This commit is contained in:
parent
514413f631
commit
dafada6d25
1 changed files with 16 additions and 22 deletions
|
@ -164,10 +164,7 @@ in
|
||||||
setup =
|
setup =
|
||||||
let
|
let
|
||||||
languageTools =
|
languageTools =
|
||||||
lang: kind:
|
lang: kind: map (v: v.name) (if hasAttr kind tools.${lang} then tools.${lang}.${kind} else [ ]);
|
||||||
builtins.map (v: v.name) (
|
|
||||||
if builtins.hasAttr kind tools.${lang} then tools.${lang}.${kind} else [ ]
|
|
||||||
);
|
|
||||||
|
|
||||||
miscLinters = languageTools "misc" "linters";
|
miscLinters = languageTools "misc" "linters";
|
||||||
miscFormatters = languageTools "misc" "formatters";
|
miscFormatters = languageTools "misc" "formatters";
|
||||||
|
@ -188,8 +185,8 @@ in
|
||||||
freeformType = types.attrs;
|
freeformType = types.attrs;
|
||||||
|
|
||||||
options =
|
options =
|
||||||
(builtins.listToAttrs (
|
(listToAttrs (
|
||||||
builtins.map (
|
map (
|
||||||
lang:
|
lang:
|
||||||
let
|
let
|
||||||
langTools = languageTools lang;
|
langTools = languageTools lang;
|
||||||
|
@ -217,19 +214,19 @@ in
|
||||||
config =
|
config =
|
||||||
let
|
let
|
||||||
cfg = config.plugins.efmls-configs;
|
cfg = config.plugins.efmls-configs;
|
||||||
toolAsList = tools: if builtins.isList tools then tools else [ tools ];
|
toolAsList = tools: if isList tools then tools else [ tools ];
|
||||||
|
|
||||||
# Tools that have been selected by the user
|
# Tools that have been selected by the user
|
||||||
tools = lists.unique (
|
tools = lists.unique (
|
||||||
builtins.filter builtins.isString (
|
filter isString (
|
||||||
builtins.concatLists (
|
concatLists (
|
||||||
builtins.map (
|
map (
|
||||||
{
|
{
|
||||||
linter ? [ ],
|
linter ? [ ],
|
||||||
formatter ? [ ],
|
formatter ? [ ],
|
||||||
}:
|
}:
|
||||||
(toolAsList linter) ++ (toolAsList formatter)
|
(toolAsList linter) ++ (toolAsList formatter)
|
||||||
) (builtins.attrValues cfg.setup)
|
) (attrValues cfg.setup)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -240,7 +237,7 @@ in
|
||||||
if cfg.externallyManagedPackages == "all" then
|
if cfg.externallyManagedPackages == "all" then
|
||||||
_: false
|
_: false
|
||||||
else
|
else
|
||||||
t: !(builtins.elem t cfg.externallyManagedPackages);
|
toolName: !(elem toolName cfg.externallyManagedPackages);
|
||||||
partition = lists.partition partitionFn tools;
|
partition = lists.partition partitionFn tools;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
@ -248,17 +245,16 @@ in
|
||||||
external = partition.wrong;
|
external = partition.wrong;
|
||||||
};
|
};
|
||||||
|
|
||||||
nixvimPkgs = lists.partition (v: builtins.hasAttr v cfg.toolPackages) pkgsForTools.nixvim;
|
nixvimPkgs = lists.partition (v: hasAttr v cfg.toolPackages) pkgsForTools.nixvim;
|
||||||
|
|
||||||
mkToolOption =
|
mkToolOption =
|
||||||
kind: opt:
|
kind: opt:
|
||||||
builtins.map (
|
map (
|
||||||
tool:
|
tool: if isString tool then helpers.mkRaw "require 'efmls-configs.${kind}.${tool}'" else tool
|
||||||
if builtins.isString tool then helpers.mkRaw "require 'efmls-configs.${kind}.${tool}'" else tool
|
|
||||||
) (toolAsList opt);
|
) (toolAsList opt);
|
||||||
|
|
||||||
setupOptions =
|
setupOptions =
|
||||||
(builtins.mapAttrs (
|
(mapAttrs (
|
||||||
_:
|
_:
|
||||||
{
|
{
|
||||||
linter ? [ ],
|
linter ? [ ],
|
||||||
|
@ -275,9 +271,9 @@ in
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPlugins = [ cfg.package ];
|
extraPlugins = [ cfg.package ];
|
||||||
|
|
||||||
warnings = optional ((builtins.length nixvimPkgs.wrong) > 0) ''
|
warnings = optional ((length nixvimPkgs.wrong) > 0) ''
|
||||||
Nixvim (plugins.efmls-configs): Following tools are not handled by nixvim, please add them to externallyManagedPackages to silence this:
|
Nixvim (plugins.efmls-configs): Following tools are not handled by nixvim, please add them to externallyManagedPackages to silence this:
|
||||||
${builtins.concatStringsSep " " nixvimPkgs.wrong}
|
${concatStringsSep " " nixvimPkgs.wrong}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
plugins.lsp.servers.efm = {
|
plugins.lsp.servers.efm = {
|
||||||
|
@ -285,8 +281,6 @@ in
|
||||||
extraOptions.settings.languages = setupOptions;
|
extraOptions.settings.languages = setupOptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
extraPackages = [
|
extraPackages = [ pkgs.efm-langserver ] ++ (map (v: cfg.toolPackages.${v}) nixvimPkgs.right);
|
||||||
pkgs.efm-langserver
|
|
||||||
] ++ (builtins.map (v: cfg.toolPackages.${v}) nixvimPkgs.right);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue