diagnostics/presets: init

This commit is contained in:
Snoweuph 2026-05-11 23:25:02 +02:00
commit 0735ee8cfd
No known key found for this signature in database
GPG key ID: BEFC41DA223CEC55
49 changed files with 892 additions and 575 deletions

View file

@ -1,32 +1,5 @@
{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";
};
inherit (lib.options) mkPackageOption;
mkGrammarOption = pkgs: grammar:
mkPackageOption pkgs ["${grammar} treesitter"] {
@ -45,5 +18,5 @@
nullable = true;
};
in {
inherit diagnostics diagnosticSubmodule mkGrammarOption mkTreesitterGrammarOption;
inherit mkGrammarOption mkTreesitterGrammarOption;
}