diagnostics/presets: init

This commit is contained in:
Snoweuph 2026-05-11 23:25:02 +02:00
commit 0e5f966c38
No known key found for this signature in database
GPG key ID: BEFC41DA223CEC55
52 changed files with 958 additions and 634 deletions

View file

@ -10,7 +10,7 @@
inherit (lib.attrsets) attrNames genAttrs;
inherit (lib.meta) getExe;
inherit (lib.nvim.attrsets) mapListToAttrs;
inherit (lib.nvim.types) mkGrammarOption diagnostics;
inherit (lib.nvim.types) mkGrammarOption;
cfg = config.vim.languages.tsx;
@ -41,16 +41,7 @@
};
defaultDiagnosticsProvider = ["biomejs"];
diagnosticsProviders = {
biomejs = let
pkg = pkgs.biome;
in {
package = pkg;
config = {
cmd = getExe pkg;
};
};
};
diagnosticsProviders = ["biomejs"];
in {
options.vim.languages.tsx = {
enable = mkEnableOption "Typescript XML (TSX) language support";
@ -97,10 +88,10 @@ in {
extraDiagnostics = {
enable = mkEnableOption "extra Typescript XML (TSX) diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;};
types = diagnostics {
langDesc = "Typescript XML (TSX)";
inherit diagnosticsProviders;
inherit defaultDiagnosticsProvider;
types = mkOption {
type = listOf (enum diagnosticsProviders);
default = defaultDiagnosticsProvider;
description = "extra Typescript XML (TSX) diagnostics providers";
};
};
};
@ -144,15 +135,15 @@ in {
})
(mkIf cfg.extraDiagnostics.enable {
vim.diagnostics.nvim-lint = {
enable = true;
linters_by_ft = {
typescriptreact = cfg.extraDiagnostics.types;
javascriptreact = cfg.extraDiagnostics.types;
vim.diagnostics = {
presets = genAttrs cfg.extraDiagnostics.types (_: {enable = true;});
nvim-lint = {
enable = true;
linters_by_ft = {
typescriptreact = cfg.extraDiagnostics.types;
javascriptreact = cfg.extraDiagnostics.types;
};
};
linters =
mkMerge (map (name: {${name} = diagnosticsProviders.${name}.config;})
cfg.extraDiagnostics.types);
};
})
]);