mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-06-13 16:25:04 +00:00
diagnostics/presets: init
This commit is contained in:
parent
69f386eca6
commit
92d33a5dc9
55 changed files with 1023 additions and 662 deletions
|
|
@ -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";
|
||||
|
|
@ -83,16 +78,16 @@ in {
|
|||
|
||||
extraDiagnostics = {
|
||||
enable =
|
||||
mkEnableOption "extra HTML diagnostics"
|
||||
mkEnableOption "extra HTML diagnostics via nvim-lint"
|
||||
// {
|
||||
default = config.vim.languages.enableExtraDiagnostics;
|
||||
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;
|
||||
};
|
||||
};
|
||||
})
|
||||
]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue