2024-11-25 15:11:53 +00:00
|
|
|
{lib}: let
|
|
|
|
inherit (lib.options) mkOption mkPackageOption;
|
|
|
|
inherit (lib.attrsets) attrNames;
|
|
|
|
inherit (lib.types) listOf either enum submodule package;
|
|
|
|
|
2023-09-23 15:36:25 +00:00
|
|
|
diagnosticSubmodule = _: {
|
2023-04-17 20:27:27 +00:00
|
|
|
options = {
|
|
|
|
type = mkOption {
|
|
|
|
description = "Type of diagnostic to enable";
|
|
|
|
type = attrNames diagnostics;
|
|
|
|
};
|
2024-11-25 15:11:53 +00:00
|
|
|
|
2023-04-17 20:27:27 +00:00
|
|
|
package = mkOption {
|
2024-11-25 15:11:53 +00:00
|
|
|
type = package;
|
2023-04-17 20:27:27 +00:00
|
|
|
description = "Diagnostics package";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-11-25 15:11:53 +00:00
|
|
|
|
2023-04-17 20:27:27 +00:00
|
|
|
diagnostics = {
|
|
|
|
langDesc,
|
2024-03-24 00:14:39 +00:00
|
|
|
diagnosticsProviders,
|
|
|
|
defaultDiagnosticsProvider,
|
2023-04-17 20:27:27 +00:00
|
|
|
}:
|
|
|
|
mkOption {
|
2024-11-25 15:11:53 +00:00
|
|
|
type = listOf (either (enum (attrNames diagnosticsProviders)) (submodule diagnosticSubmodule));
|
2024-03-24 00:14:39 +00:00
|
|
|
default = defaultDiagnosticsProvider;
|
2024-11-25 15:11:53 +00:00
|
|
|
description = "List of ${langDesc} diagnostics to enable";
|
2023-04-17 20:27:27 +00:00
|
|
|
};
|
2023-04-17 21:55:27 +00:00
|
|
|
|
|
|
|
mkGrammarOption = pkgs: grammar:
|
|
|
|
mkPackageOption pkgs ["${grammar} treesitter"] {
|
|
|
|
default = ["vimPlugins" "nvim-treesitter" "builtGrammars" grammar];
|
|
|
|
};
|
2024-11-25 15:11:53 +00:00
|
|
|
in {
|
|
|
|
inherit diagnostics diagnosticSubmodule mkGrammarOption;
|
2023-04-17 20:27:27 +00:00
|
|
|
}
|