1
0
Fork 0
mirror of https://github.com/nix-community/nixvim.git synced 2025-12-17 22:41:13 +01:00

plugins/efmls-configs: rename setup to languages

This commit is contained in:
Gaetan Lepage 2025-12-11 14:14:42 +01:00 committed by Matt Sturgeon
parent 1e0916836a
commit 4cf2afde78
2 changed files with 26 additions and 10 deletions

View file

@ -1,6 +1,7 @@
{ {
lib, lib,
config, config,
options,
pkgs, pkgs,
... ...
}: }:
@ -21,8 +22,18 @@ lib.nixvim.plugins.mkNeovimPlugin {
packageName = "efm-langserver"; packageName = "efm-langserver";
}) })
(
let
basePluginPath = [
"plugins"
"efmls-configs"
];
in
lib.mkRenamedOptionModule (basePluginPath ++ [ "setup" ]) (basePluginPath ++ [ "languages" ])
)
# Propagate setup warnings # Propagate setup warnings
{ inherit (config.plugins.efmls-configs.setup) warnings; } { inherit (config.plugins.efmls-configs.languages) warnings; }
]; ];
hasSettings = false; hasSettings = false;
@ -77,7 +88,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
}; };
} }
*/ */
setup = lib.mkOption { languages = lib.mkOption {
type = lib.types.submodule { type = lib.types.submodule {
freeformType = lib.types.attrsOf lib.types.anything; freeformType = lib.types.attrsOf lib.types.anything;
@ -115,7 +126,11 @@ lib.nixvim.plugins.mkNeovimPlugin {
}; };
}; };
}; };
description = "Configuration for each filetype. Use `all` to match any filetype."; description = ''
Configuration for each filetype. Use `all` to match any filetype.
This option is used to populate `${options.lsp.servers}.efm.config.settings.languages`.
'';
default = { }; default = { };
}; };
}; };
@ -137,7 +152,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
( (
lib.attrValues ( lib.attrValues (
# Rename aliases added 2025-06-25 in https://github.com/nix-community/nixvim/pull/3503 # Rename aliases added 2025-06-25 in https://github.com/nix-community/nixvim/pull/3503
builtins.removeAttrs cfg.setup [ builtins.removeAttrs cfg.languages [
"warnings" "warnings"
"HTML" "HTML"
"JSON" "JSON"
@ -180,7 +195,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
(mkToolValue "linters" linter) ++ (mkToolValue "formatters" formatter) (mkToolValue "linters" linter) ++ (mkToolValue "formatters" formatter)
) )
( (
builtins.removeAttrs cfg.setup [ builtins.removeAttrs cfg.languages [
"all" "all"
# Rename aliases added 2025-06-25 in https://github.com/nix-community/nixvim/pull/3503 # Rename aliases added 2025-06-25 in https://github.com/nix-community/nixvim/pull/3503
"warnings" "warnings"
@ -191,7 +206,8 @@ lib.nixvim.plugins.mkNeovimPlugin {
) )
// { // {
"=" = "=" =
(mkToolValue "linters" cfg.setup.all.linter) ++ (mkToolValue "formatters" cfg.setup.all.formatter); (mkToolValue "linters" cfg.languages.all.linter)
++ (mkToolValue "formatters" cfg.languages.all.formatter);
}; };
in in
{ {

View file

@ -6,12 +6,12 @@
all = all =
{ options, ... }: { options, ... }:
let let
inherit (options.plugins.efmls-configs) setup; inherit (options.plugins.efmls-configs) languages;
# toolOptions is an attrsets of the form: # toolOptions is an attrsets of the form:
# { <lang> = { linter = tools; formatter = tools; }; } # { <lang> = { linter = tools; formatter = tools; }; }
# Where tools is the option type representing the valid tools for this language # Where tools is the option type representing the valid tools for this language
toolOptions = builtins.removeAttrs (setup.type.getSubOptions setup.loc) [ toolOptions = builtins.removeAttrs (languages.type.getSubOptions languages.loc) [
"_freeformOptions" "_freeformOptions"
"_module" "_module"
@ -81,7 +81,7 @@
# linter = [<all valid linters for lang>]; # linter = [<all valid linters for lang>];
# formatter = [<all valid formatters for lang>]; # formatter = [<all valid formatters for lang>];
# };} # };}
setup = builtins.mapAttrs (_: builtins.mapAttrs (_: toolsFromOptions)) toolOptions; languages = builtins.mapAttrs (_: builtins.mapAttrs (_: toolsFromOptions)) toolOptions;
}; };
}; };
@ -97,7 +97,7 @@
plugins.efmls-configs = { plugins.efmls-configs = {
enable = true; enable = true;
setup = { languages = {
# Setup for all languages # Setup for all languages
all = { all = {
linter = "vale"; linter = "vale";