dev: redefine diagnostics as submodules

This commit is contained in:
NotAShelf 2023-07-30 15:02:36 +03:00
parent 500c9b67dd
commit 2f09d48e7c
No known key found for this signature in database
GPG key ID: 02D1DD3FA08B6B29
2 changed files with 242 additions and 236 deletions

View file

@ -288,16 +288,19 @@ in {
ignore = ${nvim.lua.listToLuaTable cfg.tab.sync.ignore}, ignore = ${nvim.lua.listToLuaTable cfg.tab.sync.ignore},
}, },
}, },
notify = { notify = {
threshold = vim.log.levels.${cfg.notify.threshold}, threshold = vim.log.levels.${cfg.notify.threshold},
absolute_path = ${boolToString cfg.notify.absolutePath}, absolute_path = ${boolToString cfg.notify.absolutePath},
}, },
ui = { ui = {
confirm = { confirm = {
remove = ${boolToString cfg.ui.confirm.remove}, remove = ${boolToString cfg.ui.confirm.remove},
trash = ${boolToString cfg.ui.confirm.trash}, trash = ${boolToString cfg.ui.confirm.trash},
}, },
}, },
})''; })
'';
}; };
} }

View file

@ -118,6 +118,12 @@ with builtins; {
hijackDirectories = mkOption { hijackDirectories = mkOption {
description = "hijack new directory buffers when they are opened (`:e dir`)."; description = "hijack new directory buffers when they are opened (`:e dir`).";
default = {
enable = true;
autoOpen = false;
};
type = types.submodule { type = types.submodule {
options = { options = {
enable = mkOption { enable = mkOption {
@ -136,10 +142,6 @@ with builtins; {
}; };
}; };
}; };
default = {
enable = true;
autoOpen = false;
};
}; };
updateFocusedFile = mkOption { updateFocusedFile = mkOption {
@ -147,6 +149,13 @@ with builtins; {
Update the focused file on `BufEnter`, un-collapses the folders recursively Update the focused file on `BufEnter`, un-collapses the folders recursively
until it finds the file. until it finds the file.
''; '';
default = {
enable = false;
updateRoot = false;
ignoreList = [];
};
type = types.submodule { type = types.submodule {
options = { options = {
enable = mkEnableOption "update focused file"; enable = mkEnableOption "update focused file";
@ -169,9 +178,6 @@ with builtins; {
}; };
}; };
}; };
default = {
ignoreList = [];
};
}; };
systemOpen = { systemOpen = {
@ -199,11 +205,23 @@ with builtins; {
debounceDelay = 50; debounceDelay = 50;
showOnDirs = false; showOnDirs = false;
showOnOpenDirs = true; showOnOpenDirs = true;
icons = {
hint = "";
info = "";
warning = "";
error = "";
};
severity = {
min = "HINT";
max = "ERROR";
};
}; };
type = types.submodule { type = types.submodule {
options = { options = {
enable = mkEnableOption "diagnostics"; enable = mkEnableOption "Enable diagnostics view in the signcolumn.";
debounceDelay = mkOption { debounceDelay = mkOption {
description = "Idle milliseconds between diagnostic event and update."; description = "Idle milliseconds between diagnostic event and update.";
@ -212,24 +230,17 @@ with builtins; {
showOnDirs = mkOption { showOnDirs = mkOption {
description = "Show diagnostic icons on parent directories."; description = "Show diagnostic icons on parent directories.";
type = types.bool;
}; };
showOnOpenDirs = mkOption { showOnOpenDirs = mkOption {
description = "Show diagnostics icons on directories that are open."; description = ''
type = types.bool; Show diagnostics icons on directories that are open.
Only relevant when `diagnostics.show_on_dirs` is `true`.
'';
}; };
icons = mkOption { icons = mkOption {
description = "Icons for diagnostic severity."; description = "Icons for diagnostic severity.";
default = {
hint = "";
info = "";
warning = "";
error = "";
};
type = types.submodule { type = types.submodule {
options = { options = {
hint = mkOption { hint = mkOption {
@ -253,13 +264,7 @@ with builtins; {
}; };
severity = mkOption { severity = mkOption {
description = "Severity for which the diagnostics will be displayed"; description = "Severity for which the diagnostics will be displayed. See `:help diagnostic-severity`";
default = {
min = "HINT";
max = "ERROR";
};
type = types.submodule { type = types.submodule {
options = { options = {
min = mkOption { min = mkOption {
@ -316,6 +321,7 @@ with builtins; {
description = "Indicate which file have unsaved modification."; description = "Indicate which file have unsaved modification.";
default = { default = {
enable = false;
showOnDirs = true; showOnDirs = true;
showOnOpenDirs = true; showOnOpenDirs = true;
}; };
@ -382,6 +388,7 @@ with builtins; {
view = mkOption { view = mkOption {
description = "Window / buffer setup."; description = "Window / buffer setup.";
default = { default = {
centralizeSelection = false; centralizeSelection = false;
cursorline = true; cursorline = true;
@ -405,6 +412,7 @@ with builtins; {
}; };
}; };
}; };
type = types.submodule { type = types.submodule {
options = { options = {
centralizeSelection = mkOption { centralizeSelection = mkOption {
@ -1066,13 +1074,6 @@ with builtins; {
options = { options = {
sync = mkOption { sync = mkOption {
description = "Configuration for syncing nvim-tree across tabs."; description = "Configuration for syncing nvim-tree across tabs.";
default = {
open = false;
close = false;
ignore = [];
};
type = types.submodule { type = types.submodule {
options = { options = {
open = mkOption { open = mkOption {
@ -1126,8 +1127,10 @@ with builtins; {
}; };
}; };
}; };
ui = mkOption { ui = mkOption {
description = "General UI configuration."; description = "General UI configuration.";
default = { default = {
confirm = { confirm = {
remove = true; remove = true;