mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-12-17 09:21:19 +00:00
modules/completion: rewrite
This commit is contained in:
parent
7a8b95cf7c
commit
130f64d1ee
20 changed files with 331 additions and 362 deletions
5
lib/attrsets.nix
Normal file
5
lib/attrsets.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{lib}: let
|
||||
inherit (builtins) listToAttrs;
|
||||
in {
|
||||
mapListToAttrs = f: list: listToAttrs (map f list);
|
||||
}
|
||||
|
|
@ -10,6 +10,7 @@
|
|||
dag = import ./dag.nix {inherit lib;};
|
||||
languages = import ./languages.nix {inherit lib;};
|
||||
lists = import ./lists.nix {inherit lib;};
|
||||
attrsets = import ./attrsets.nix {inherit lib;};
|
||||
lua = import ./lua.nix {inherit lib;};
|
||||
neovimConfiguration = import ../modules {inherit inputs lib;};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
{lib}: let
|
||||
inherit (builtins) isString getAttr;
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.attrsets) listToAttrs;
|
||||
inherit (lib.types) bool;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
in {
|
||||
# Converts a boolean to a yes/no string. This is used in lots of
|
||||
# configuration formats.
|
||||
|
|
@ -12,21 +12,21 @@ in {
|
|||
config,
|
||||
diagnosticsProviders,
|
||||
}:
|
||||
listToAttrs
|
||||
(map (v: let
|
||||
type =
|
||||
if isString v
|
||||
then v
|
||||
else getAttr v.type;
|
||||
package =
|
||||
if isString v
|
||||
then diagnosticsProviders.${type}.package
|
||||
else v.package;
|
||||
in {
|
||||
name = "${lang}-diagnostics-${type}";
|
||||
value = diagnosticsProviders.${type}.nullConfig package;
|
||||
})
|
||||
config);
|
||||
mapListToAttrs
|
||||
(v: let
|
||||
type =
|
||||
if isString v
|
||||
then v
|
||||
else getAttr v.type;
|
||||
package =
|
||||
if isString v
|
||||
then diagnosticsProviders.${type}.package
|
||||
else v.package;
|
||||
in {
|
||||
name = "${lang}-diagnostics-${type}";
|
||||
value = diagnosticsProviders.${type}.nullConfig package;
|
||||
})
|
||||
config;
|
||||
|
||||
mkEnable = desc:
|
||||
mkOption {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue