mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-05-20 13:59:22 +00:00
diagnostics/presets: init
This commit is contained in:
parent
cd45295f9c
commit
0735ee8cfd
49 changed files with 892 additions and 575 deletions
|
|
@ -6,10 +6,10 @@
|
|||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.options) literalExpression mkEnableOption mkOption;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.types) listOf enum;
|
||||
inherit (lib) genAttrs;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
|
||||
cfg = config.vim.languages.make;
|
||||
|
|
@ -22,13 +22,7 @@
|
|||
};
|
||||
|
||||
defaultDiagnosticsProvider = ["checkmake"];
|
||||
diagnosticsProviders = {
|
||||
checkmake = {
|
||||
config = {
|
||||
cmd = getExe pkgs.checkmake;
|
||||
};
|
||||
};
|
||||
};
|
||||
diagnosticsProviders = ["checkmake"];
|
||||
in {
|
||||
options.vim.languages.make = {
|
||||
enable = mkEnableOption "Make support";
|
||||
|
|
@ -64,10 +58,10 @@ in {
|
|||
default = config.vim.languages.enableExtraDiagnostics;
|
||||
defaultText = literalExpression "config.vim.languages.enableExtraDiagnostics";
|
||||
};
|
||||
types = diagnostics {
|
||||
langDesc = "Make";
|
||||
inherit diagnosticsProviders;
|
||||
inherit defaultDiagnosticsProvider;
|
||||
types = mkOption {
|
||||
type = listOf (enum diagnosticsProviders);
|
||||
default = defaultDiagnosticsProvider;
|
||||
description = "extra Make diagnostics providers";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
@ -96,12 +90,12 @@ in {
|
|||
})
|
||||
|
||||
(mkIf cfg.extraDiagnostics.enable {
|
||||
vim.diagnostics.nvim-lint = {
|
||||
enable = true;
|
||||
linters_by_ft.make = 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.make = cfg.extraDiagnostics.types;
|
||||
};
|
||||
};
|
||||
})
|
||||
]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue