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

@ -5,13 +5,12 @@
...
}: let
inherit (builtins) attrNames;
inherit (lib.meta) getExe;
inherit (lib.options) literalExpression mkEnableOption mkOption;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.types) bool enum listOf;
inherit (lib) genAttrs;
inherit (lib.lists) optional;
inherit (lib.nvim.types) mkGrammarOption diagnostics deprecatedSingleOrListOf;
inherit (lib.nvim.types) mkGrammarOption deprecatedSingleOrListOf;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.attrsets) mapListToAttrs;
@ -29,11 +28,7 @@
};
defaultDiagnosticsProvider = ["htmlhint"];
diagnosticsProviders = {
htmlhint = {
config.cmd = getExe pkgs.htmlhint;
};
};
diagnosticsProviders = ["htmlhint"];
in {
options.vim.languages.html = {
enable = mkEnableOption "HTML language support";
@ -89,10 +84,10 @@ in {
defaultText = literalExpression "config.vim.languages.enableExtraDiagnostics";
};
types = diagnostics {
langDesc = "HTML";
inherit diagnosticsProviders;
inherit defaultDiagnosticsProvider;
types = mkOption {
type = listOf (enum diagnosticsProviders);
default = defaultDiagnosticsProvider;
description = "extra HTML diagnostics providers";
};
};
};
@ -138,13 +133,12 @@ in {
})
(mkIf cfg.extraDiagnostics.enable {
vim.diagnostics.nvim-lint = {
enable = true;
linters_by_ft.html = cfg.extraDiagnostics.types;
linters = mkMerge (map (name: {
${name} = diagnosticsProviders.${name}.config;
})
cfg.extraDiagnostics.types);
vim.diagnostics = {
presets = genAttrs cfg.extraDiagnostics.types (_: {enable = true;});
nvim-lint = {
enable = true;
linters_by_ft.html = cfg.extraDiagnostics.types;
};
};
})
]);