mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-06-24 13:24:39 +00:00
diagnostics/presets/cpplint: init
This commit is contained in:
parent
0e5f966c38
commit
036423b86e
4 changed files with 54 additions and 0 deletions
|
|
@ -332,6 +332,8 @@
|
||||||
- Moved extra diagnostic modules under `diagnostics.presets.<name>` this will
|
- Moved extra diagnostic modules under `diagnostics.presets.<name>` this will
|
||||||
allow for more flexibility in the future for nvf.
|
allow for more flexibility in the future for nvf.
|
||||||
|
|
||||||
|
- Added {option}`vim.diagnostics.presets.cpplint.enable`.
|
||||||
|
|
||||||
- Added {option}`vim.treesitter.queries` to support adding custom queries.
|
- Added {option}`vim.treesitter.queries` to support adding custom queries.
|
||||||
|
|
||||||
- Added injections for `query = '' ... ''` as `query` and `mkLualine '' ... ''`,
|
- Added injections for `query = '' ... ''` as `query` and `mkLualine '' ... ''`,
|
||||||
|
|
|
||||||
20
modules/plugins/diagnostics/presets/cpplint.nix
Normal file
20
modules/plugins/diagnostics/presets/cpplint.nix
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.meta) getExe;
|
||||||
|
inherit (lib.modules) mkIf;
|
||||||
|
inherit (lib.nvim.types) mkDiagnosticsPresetEnableOption;
|
||||||
|
|
||||||
|
cfg = config.vim.diagnostics.presets.cpplint;
|
||||||
|
in {
|
||||||
|
options.vim.diagnostics.presets.cpplint = {
|
||||||
|
enable = mkDiagnosticsPresetEnableOption "cpplint" "cpplint";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
vim.diagnostics.nvim-lint.linters.cpplint.cmd = getExe pkgs.cpplint;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
imports = [
|
imports = [
|
||||||
./biomejs.nix
|
./biomejs.nix
|
||||||
./checkmake.nix
|
./checkmake.nix
|
||||||
|
./cpplint.nix
|
||||||
./deadnix.nix
|
./deadnix.nix
|
||||||
./djlint.nix
|
./djlint.nix
|
||||||
./dotenv-linter.nix
|
./dotenv-linter.nix
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,9 @@
|
||||||
};
|
};
|
||||||
clang-format.command = getExe' pkgs.clang-tools "clang-format";
|
clang-format.command = getExe' pkgs.clang-tools "clang-format";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
defaultDiagnosticsProvider = ["cpplint"];
|
||||||
|
diagnosticsProviders = ["cpplint"];
|
||||||
in {
|
in {
|
||||||
options.vim.languages.clang = {
|
options.vim.languages.clang = {
|
||||||
enable = mkEnableOption "C/C++ language support";
|
enable = mkEnableOption "C/C++ language support";
|
||||||
|
|
@ -168,6 +171,21 @@ in {
|
||||||
description = "C formatter to use";
|
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 [
|
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;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue