diagnostics/presets/cpplint: init

This commit is contained in:
Snoweuph 2026-05-12 00:34:38 +02:00
commit 036423b86e
No known key found for this signature in database
GPG key ID: BEFC41DA223CEC55
4 changed files with 54 additions and 0 deletions

View file

@ -96,6 +96,9 @@
};
clang-format.command = getExe' pkgs.clang-tools "clang-format";
};
defaultDiagnosticsProvider = ["cpplint"];
diagnosticsProviders = ["cpplint"];
in {
options.vim.languages.clang = {
enable = mkEnableOption "C/C++ language support";
@ -168,6 +171,21 @@ in {
description = "C formatter to use";
};
};
extraDiagnostics = {
enable =
mkEnableOption "extra C/C++ diagnostics"
// {
default = config.vim.languages.enableExtraDiagnostics;
defaultText = literalExpression "config.vim.languages.enableExtraDiagnostics";
};
types = mkOption {
type = listOf (enum diagnosticsProviders);
default = defaultDiagnosticsProvider;
description = "extra C/C++ diagnostics providers";
};
};
};
config = mkIf cfg.enable (mkMerge [
@ -211,5 +229,18 @@ in {
};
};
})
(mkIf cfg.extraDiagnostics.enable {
vim.diagnostics = {
presets = genAttrs cfg.extraDiagnostics.types (_: {enable = true;});
nvim-lint = {
enable = true;
linters_by_ft = {
c = cfg.extraDiagnostics.types;
cpp = cfg.extraDiagnostics.types;
};
};
};
})
]);
}