mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-05-20 22:08:47 +00:00
diagnostics/presets/cpplint: init
This commit is contained in:
parent
0735ee8cfd
commit
3cd71e08d0
4 changed files with 53 additions and 0 deletions
|
|
@ -300,6 +300,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
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,8 @@
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
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";
|
||||||
|
|
@ -102,6 +104,21 @@ in {
|
||||||
default = debuggers.${cfg.dap.debugger}.package;
|
default = debuggers.${cfg.dap.debugger}.package;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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 [
|
||||||
|
|
@ -127,5 +144,18 @@ in {
|
||||||
vim.debugger.nvim-dap.enable = true;
|
vim.debugger.nvim-dap.enable = true;
|
||||||
vim.debugger.nvim-dap.sources.clang-debugger = debuggers.${cfg.dap.debugger}.dapConfig;
|
vim.debugger.nvim-dap.sources.clang-debugger = debuggers.${cfg.dap.debugger}.dapConfig;
|
||||||
})
|
})
|
||||||
|
|
||||||
|
(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