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
|
|
@ -10,7 +10,7 @@
|
|||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.types) enum bool listOf;
|
||||
inherit (lib) genAttrs;
|
||||
inherit (lib.nvim.types) diagnostics mkGrammarOption deprecatedSingleOrListOf enumWithRename;
|
||||
inherit (lib.nvim.types) mkGrammarOption deprecatedSingleOrListOf enumWithRename;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
|
||||
cfg = config.vim.languages.bash;
|
||||
|
|
@ -26,11 +26,7 @@
|
|||
};
|
||||
|
||||
defaultDiagnosticsProvider = ["shellcheck"];
|
||||
diagnosticsProviders = {
|
||||
shellcheck = {
|
||||
package = pkgs.shellcheck;
|
||||
};
|
||||
};
|
||||
diagnosticsProviders = ["shellcheck"];
|
||||
in {
|
||||
options.vim.languages.bash = {
|
||||
enable = mkEnableOption "Bash language support";
|
||||
|
|
@ -80,15 +76,16 @@ in {
|
|||
|
||||
extraDiagnostics = {
|
||||
enable =
|
||||
mkEnableOption "extra Bash diagnostics"
|
||||
mkEnableOption "extra Shell diagnostics"
|
||||
// {
|
||||
default = config.vim.languages.enableExtraDiagnostics;
|
||||
defaultText = literalExpression "config.vim.languages.enableExtraDiagnostics";
|
||||
};
|
||||
types = diagnostics {
|
||||
langDesc = "Bash";
|
||||
inherit diagnosticsProviders;
|
||||
inherit defaultDiagnosticsProvider;
|
||||
|
||||
types = mkOption {
|
||||
type = listOf (enum diagnosticsProviders);
|
||||
default = defaultDiagnosticsProvider;
|
||||
description = "extra Shell diagnostics providers";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
@ -128,13 +125,16 @@ in {
|
|||
})
|
||||
|
||||
(mkIf cfg.extraDiagnostics.enable {
|
||||
vim.diagnostics.nvim-lint = {
|
||||
enable = true;
|
||||
linters_by_ft.sh = cfg.extraDiagnostics.types;
|
||||
linters = mkMerge (map (name: {
|
||||
${name}.cmd = getExe diagnosticsProviders.${name}.package;
|
||||
})
|
||||
cfg.extraDiagnostics.types);
|
||||
vim.diagnostics = {
|
||||
presets = genAttrs cfg.extraDiagnostics.types (_: {enable = true;});
|
||||
nvim-lint = {
|
||||
enable = true;
|
||||
linters_by_ft = {
|
||||
sh = cfg.extraDiagnostics.types;
|
||||
bash = cfg.extraDiagnostics.types;
|
||||
zsh = cfg.extraDiagnostics.types;
|
||||
};
|
||||
};
|
||||
};
|
||||
})
|
||||
]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue