From 39d1c950616bf31ca5110ab14008f29b5ab807e7 Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Fri, 21 Jun 2024 12:55:10 +0100 Subject: [PATCH] modules/diagnostic: init --- modules/default.nix | 1 + modules/diagnostic.nix | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 modules/diagnostic.nix diff --git a/modules/default.nix b/modules/default.nix index 073db594..7b1e8774 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -4,6 +4,7 @@ ./clipboard.nix ./colorscheme.nix ./commands.nix + ./diagnostic.nix ./doc.nix ./editorconfig.nix ./filetype.nix diff --git a/modules/diagnostic.nix b/modules/diagnostic.nix new file mode 100644 index 00000000..0daee58e --- /dev/null +++ b/modules/diagnostic.nix @@ -0,0 +1,26 @@ +{ + lib, + helpers, + config, + ... +}: +with lib; +{ + options = { + diagnostics = mkOption { + type = with types; attrsOf anything; + default = { }; + description = "The configuration diagnostic options, provided to `vim.diagnostic.config`."; + example = { + virtual_text = false; + virtual_lines.only_current_line = true; + }; + }; + }; + + config = { + extraConfigLuaPre = optionalString (config.diagnostics != { }) '' + vim.diagnostic.config(${helpers.toLuaObject config.diagnostics}) + ''; + }; +}