mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-06-12 15:58:58 +00:00
diagnostics/presets: init
This commit is contained in:
parent
29f7eb8491
commit
0e5f966c38
52 changed files with 958 additions and 634 deletions
|
|
@ -6,11 +6,9 @@
|
|||
}: let
|
||||
inherit (lib.options) literalExpression mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib) genAttrs;
|
||||
inherit (lib.types) enum listOf;
|
||||
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
|
||||
cfg = config.vim.languages.kotlin;
|
||||
|
||||
|
|
@ -18,11 +16,7 @@
|
|||
servers = ["kotlin-language-server"];
|
||||
|
||||
defaultDiagnosticsProvider = ["ktlint"];
|
||||
diagnosticsProviders = {
|
||||
ktlint = {
|
||||
package = pkgs.ktlint;
|
||||
};
|
||||
};
|
||||
diagnosticsProviders = ["ktlint"];
|
||||
in {
|
||||
options.vim.languages.kotlin = {
|
||||
enable = mkEnableOption "Kotlin/HCL support";
|
||||
|
|
@ -59,10 +53,10 @@ in {
|
|||
defaultText = literalExpression "config.vim.languages.enableExtraDiagnostics";
|
||||
};
|
||||
|
||||
types = diagnostics {
|
||||
langDesc = "Kotlin";
|
||||
inherit diagnosticsProviders;
|
||||
inherit defaultDiagnosticsProvider;
|
||||
types = mkOption {
|
||||
type = listOf (enum diagnosticsProviders);
|
||||
default = defaultDiagnosticsProvider;
|
||||
description = "extra Kotlin diagnostics providers";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
@ -73,13 +67,12 @@ in {
|
|||
})
|
||||
|
||||
(mkIf cfg.extraDiagnostics.enable {
|
||||
vim.diagnostics.nvim-lint = {
|
||||
enable = true;
|
||||
linters_by_ft.kotlin = 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.kotlin = cfg.extraDiagnostics.types;
|
||||
};
|
||||
};
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue