mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-05-19 21:46:32 +00:00
diagnostics/presets: init
This commit is contained in:
parent
cd45295f9c
commit
0735ee8cfd
49 changed files with 892 additions and 575 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";
|
||||
|
|
@ -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;
|
||||
};
|
||||
};
|
||||
})
|
||||
]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue