plugins/trouble: remove with lib and helpers

This commit is contained in:
Austin Horstman 2024-10-10 21:38:36 -05:00
parent df515c651e
commit 066ee7d0a9
No known key found for this signature in database

View file

@ -1,17 +1,17 @@
{ {
config, config,
lib, lib,
helpers,
options,
... ...
}: }:
with lib; let
helpers.neovim-plugin.mkNeovimPlugin { inherit (lib.nixvim) defaultNullOpts;
in
lib.nixvim.neovim-plugin.mkNeovimPlugin {
name = "trouble"; name = "trouble";
originalName = "trouble-nvim"; originalName = "trouble-nvim";
package = "trouble-nvim"; package = "trouble-nvim";
maintainers = [ maintainers.loicreynier ]; maintainers = [ lib.maintainers.loicreynier ];
# TODO introduced 2024-03-15: remove 2024-05-15 # TODO introduced 2024-03-15: remove 2024-05-15
optionsRenamedToSettings = [ optionsRenamedToSettings = [
@ -116,7 +116,7 @@ helpers.neovim-plugin.mkNeovimPlugin {
settingsOptions = { settingsOptions = {
position = position =
helpers.defaultNullOpts.mkEnum defaultNullOpts.mkEnum
[ [
"top" "top"
"left" "left"
@ -128,17 +128,17 @@ helpers.neovim-plugin.mkNeovimPlugin {
Position of the list. Position of the list.
''; '';
height = helpers.defaultNullOpts.mkInt 10 '' height = defaultNullOpts.mkInt 10 ''
Height of the trouble list when position is top or bottom. Height of the trouble list when position is top or bottom.
''; '';
width = helpers.defaultNullOpts.mkInt 50 '' width = defaultNullOpts.mkInt 50 ''
Width of the list when position is left or right. Width of the list when position is left or right.
''; '';
icons = helpers.defaultNullOpts.mkBool true "Use devicons for filenames"; icons = defaultNullOpts.mkBool true "Use devicons for filenames";
mode = helpers.defaultNullOpts.mkEnum [ mode = defaultNullOpts.mkEnum [
"workspace_diagnostics" "workspace_diagnostics"
"document_diagnostics" "document_diagnostics"
"quickfix" "quickfix"
@ -146,22 +146,22 @@ helpers.neovim-plugin.mkNeovimPlugin {
"loclist" "loclist"
] "workspace_diagnostics" "Mode for default list"; ] "workspace_diagnostics" "Mode for default list";
fold_open = helpers.defaultNullOpts.mkStr "" "Icon used for open folds"; fold_open = defaultNullOpts.mkStr "" "Icon used for open folds";
fold_closed = helpers.defaultNullOpts.mkStr "" "Icon used for closed folds"; fold_closed = defaultNullOpts.mkStr "" "Icon used for closed folds";
group = helpers.defaultNullOpts.mkBool true "Group results by file"; group = defaultNullOpts.mkBool true "Group results by file";
padding = helpers.defaultNullOpts.mkBool true "Add an extra new line on top of the list"; padding = defaultNullOpts.mkBool true "Add an extra new line on top of the list";
cycle_results = helpers.defaultNullOpts.mkBool true "Whether to cycle item list when reaching beginning or end of list"; cycle_results = defaultNullOpts.mkBool true "Whether to cycle item list when reaching beginning or end of list";
action_keys = action_keys =
mapAttrs lib.mapAttrs
( (
action: config: action: config:
helpers.defaultNullOpts.mkNullable ( defaultNullOpts.mkNullable (
with types; either str (listOf str) with lib.types; either str (listOf str)
) config.default config.description ) config.default config.description
) )
{ {
@ -247,47 +247,40 @@ helpers.neovim-plugin.mkNeovimPlugin {
}; };
}; };
indent_lines = helpers.defaultNullOpts.mkBool true '' indent_lines = defaultNullOpts.mkBool true ''
Add an indent guide below the fold icons. Add an indent guide below the fold icons.
''; '';
win_config = helpers.defaultNullOpts.mkAttrsOf types.anything { win_config = defaultNullOpts.mkAttrsOf lib.types.anything {
border = "single"; border = "single";
} "Configuration for floating windows. See `|nvim_open_win()|`."; } "Configuration for floating windows. See `|nvim_open_win()|`.";
auto_open = helpers.defaultNullOpts.mkBool false '' auto_close = defaultNullOpts.mkBool false ''
Automatically open the list when you have diagnostics.
'';
auto_close = helpers.defaultNullOpts.mkBool false ''
Automatically close the list when you have no diagnostics. Automatically close the list when you have no diagnostics.
''; '';
auto_preview = helpers.defaultNullOpts.mkBool true '' auto_preview = defaultNullOpts.mkBool true ''
Automatically preview the location of the diagnostic. Automatically preview the location of the diagnostic.
<esc> to close preview and go back to last window. <esc> to close preview and go back to last window.
''; '';
auto_fold = helpers.defaultNullOpts.mkBool false '' auto_fold = defaultNullOpts.mkBool false ''
Automatically fold a file trouble list at creation. Automatically fold a file trouble list at creation.
''; '';
auto_jump = helpers.defaultNullOpts.mkListOf types.str [ "lsp_definitions" ] '' auto_jump = defaultNullOpts.mkListOf lib.types.str [ "lsp_definitions" ] ''
For the given modes, automatically jump if there is only a single result. For the given modes, automatically jump if there is only a single result.
''; '';
include_declaration = helpers.defaultNullOpts.mkListOf types.str [ include_declaration = defaultNullOpts.mkListOf lib.types.str [
"lsp_references" "lsp_references"
"lsp_implementations" "lsp_implementations"
"lsp_definitions" "lsp_definitions"
] "For the given modes, include the declaration of the current symbol in the results."; ] "For the given modes, include the declaration of the current symbol in the results.";
signs = signs =
mapAttrs lib.mapAttrs
( (diagnostic: default: defaultNullOpts.mkStr default "Icon/text for ${diagnostic} diagnostics.")
diagnostic: default:
helpers.defaultNullOpts.mkStr default "Icon/text for ${diagnostic} diagnostics."
)
{ {
error = ""; error = "";
warning = ""; warning = "";
@ -296,19 +289,19 @@ helpers.neovim-plugin.mkNeovimPlugin {
other = ""; other = "";
}; };
use_diagnostic_signs = helpers.defaultNullOpts.mkBool false '' use_diagnostic_signs = defaultNullOpts.mkBool false ''
Enabling this will use the signs defined in your lsp client Enabling this will use the signs defined in your lsp client
''; '';
}; };
extraConfig = cfg: { extraConfig = cfg: {
# TODO: added 2024-09-20 remove after 24.11 # TODO: added 2024-09-20 remove after 24.11
plugins.web-devicons = mkIf ( plugins.web-devicons = lib.mkIf (
!( !(
config.plugins.mini.enable config.plugins.mini.enable
&& config.plugins.mini.modules ? icons && config.plugins.mini.modules ? icons
&& config.plugins.mini.mockDevIcons && config.plugins.mini.mockDevIcons
) )
) { enable = mkOverride 1490 true; }; ) { enable = lib.mkOverride 1490 true; };
}; };
} }