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