mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
modules/diagnostic: rename diagnostics
-> diagnostic.config
Currently we represent `vim.diagnostic.config()` as a top-level `diagnostics` option. This means we have no clear namespace for (e.g.) `vim.diagnostic.<action>` keymap functions.
This commit is contained in:
parent
c3a42a7ac4
commit
6c73350557
6 changed files with 38 additions and 30 deletions
|
@ -10,7 +10,7 @@
|
||||||
./colorscheme.nix
|
./colorscheme.nix
|
||||||
./commands.nix
|
./commands.nix
|
||||||
./dependencies.nix
|
./dependencies.nix
|
||||||
./diagnostics.nix
|
./diagnostic.nix
|
||||||
./doc.nix
|
./doc.nix
|
||||||
./editorconfig.nix
|
./editorconfig.nix
|
||||||
./files.nix
|
./files.nix
|
||||||
|
|
32
modules/diagnostic.nix
Normal file
32
modules/diagnostic.nix
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
cfg = config.diagnostic;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.diagnostic = {
|
||||||
|
config = lib.mkOption {
|
||||||
|
type = with lib.types; attrsOf anything;
|
||||||
|
default = { };
|
||||||
|
description = "The configuration diagnostic options, provided to `vim.diagnostic.config`.";
|
||||||
|
example = {
|
||||||
|
virtual_text = false;
|
||||||
|
virtual_lines.current_line = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
imports = [
|
||||||
|
# TODO: Added 2025-04-26; remove after 25.05
|
||||||
|
(lib.mkRenamedOptionModule [ "diagnostics" ] [ "diagnostic" "config" ])
|
||||||
|
];
|
||||||
|
|
||||||
|
config = {
|
||||||
|
extraConfigLuaPre = lib.mkIf (cfg.config != { }) ''
|
||||||
|
vim.diagnostic.config(${lib.nixvim.toLuaObject cfg.config})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,25 +0,0 @@
|
||||||
{
|
|
||||||
lib,
|
|
||||||
helpers,
|
|
||||||
config,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
{
|
|
||||||
options = {
|
|
||||||
diagnostics = lib.mkOption {
|
|
||||||
type = with lib.types; attrsOf anything;
|
|
||||||
default = { };
|
|
||||||
description = "The configuration diagnostic options, provided to `vim.diagnostic.config`.";
|
|
||||||
example = {
|
|
||||||
virtual_text = false;
|
|
||||||
virtual_lines.current_line = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = {
|
|
||||||
extraConfigLuaPre = lib.mkIf (config.diagnostics != { }) ''
|
|
||||||
vim.diagnostic.config(${lib.nixvim.toLuaObject config.diagnostics})
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -24,7 +24,8 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
||||||
"currentLine"
|
"currentLine"
|
||||||
]
|
]
|
||||||
[
|
[
|
||||||
"diagnostics"
|
"diagnostic"
|
||||||
|
"config"
|
||||||
"virtual_lines"
|
"virtual_lines"
|
||||||
"only_current_line"
|
"only_current_line"
|
||||||
]
|
]
|
||||||
|
@ -33,6 +34,6 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
||||||
|
|
||||||
extraConfig = {
|
extraConfig = {
|
||||||
# Strongly recommended by the plugin, to avoid duplication.
|
# Strongly recommended by the plugin, to avoid duplication.
|
||||||
diagnostics.virtual_text = mkDefault false;
|
diagnostic.config.virtual_text = mkDefault false;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
example = {
|
example = {
|
||||||
diagnostics = {
|
diagnostic.config = {
|
||||||
virtual_text = false;
|
virtual_text = false;
|
||||||
virtual_lines.current_line = true;
|
virtual_lines.current_line = true;
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
example = {
|
example = {
|
||||||
plugins.lsp-lines.enable = true;
|
plugins.lsp-lines.enable = true;
|
||||||
|
|
||||||
diagnostics.virtual_lines = {
|
diagnostic.config.virtual_lines = {
|
||||||
only_current_line = true;
|
only_current_line = true;
|
||||||
highlight_whole_line = false;
|
highlight_whole_line = false;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue