mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-12-29 19:29:49 +01:00
37 lines
1,011 B
Nix
37 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;
|
|
}
|