mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-30 00:26:45 +00:00
38 lines
1,011 B
Nix
38 lines
1,011 B
Nix
{lib}: let
|
|
inherit (lib.options) mkOption mkPackageOption;
|
|
inherit (lib.attrsets) attrNames;
|
|
inherit (lib.types) listOf either enum submodule package;
|
|
|
|
diagnosticSubmodule = _: {
|
|
options = {
|
|
type = mkOption {
|
|
description = "Type of diagnostic to enable";
|
|
type = attrNames diagnostics;
|
|
};
|
|
|
|
package = mkOption {
|
|
type = package;
|
|
description = "Diagnostics package";
|
|
};
|
|
};
|
|
};
|
|
|
|
diagnostics = {
|
|
langDesc,
|
|
diagnosticsProviders,
|
|
defaultDiagnosticsProvider,
|
|
}:
|
|
mkOption {
|
|
type = listOf (either (enum (attrNames diagnosticsProviders)) (submodule diagnosticSubmodule));
|
|
default = defaultDiagnosticsProvider;
|
|
description = "List of ${langDesc} diagnostics to enable";
|
|
};
|
|
|
|
mkGrammarOption = pkgs: grammar:
|
|
mkPackageOption pkgs ["${grammar} treesitter"] {
|
|
default = ["vimPlugins" "nvim-treesitter" "builtGrammars" grammar];
|
|
};
|
|
in {
|
|
inherit diagnostics diagnosticSubmodule mkGrammarOption;
|
|
}
|