2023-02-01 19:11:37 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
2023-11-08 02:16:46 +00:00
|
|
|
}: let
|
2024-09-30 19:58:48 +00:00
|
|
|
inherit (lib.modules) mkIf;
|
|
|
|
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLznBinding pushDownDefault;
|
2023-11-08 02:16:46 +00:00
|
|
|
|
2023-02-01 19:11:37 +00:00
|
|
|
cfg = config.vim.lsp;
|
2023-05-02 21:28:40 +00:00
|
|
|
|
|
|
|
self = import ./trouble.nix {inherit lib;};
|
|
|
|
mappingDefinitions = self.options.vim.lsp.trouble.mappings;
|
|
|
|
mappings = addDescriptionsToMappings cfg.trouble.mappings mappingDefinitions;
|
2023-02-01 19:11:37 +00:00
|
|
|
in {
|
|
|
|
config = mkIf (cfg.enable && cfg.trouble.enable) {
|
2024-03-12 00:46:29 +00:00
|
|
|
vim = {
|
2024-09-30 19:58:48 +00:00
|
|
|
lazy.plugins = [
|
|
|
|
{
|
|
|
|
package = "trouble";
|
|
|
|
setupModule = "trouble";
|
|
|
|
inherit (cfg.trouble) setupOpts;
|
2023-02-01 19:11:37 +00:00
|
|
|
|
2024-09-30 19:58:48 +00:00
|
|
|
cmd = "Trouble";
|
|
|
|
keys = [
|
|
|
|
(mkSetLznBinding mappings.toggle "<cmd>TroubleToggle<CR>")
|
|
|
|
(mkSetLznBinding mappings.workspaceDiagnostics "<cmd>TroubleToggle workspace_diagnostics<CR>")
|
|
|
|
(mkSetLznBinding mappings.documentDiagnostics "<cmd>TroubleToggle document_diagnostics<CR>")
|
|
|
|
(mkSetLznBinding mappings.lspReferences "<cmd>TroubleToggle lsp_references<CR>")
|
|
|
|
(mkSetLznBinding mappings.quickfix "<cmd>TroubleToggle quickfix<CR>")
|
|
|
|
(mkSetLznBinding mappings.locList "<cmd>TroubleToggle loclist<CR>")
|
|
|
|
];
|
|
|
|
}
|
2024-03-12 00:46:29 +00:00
|
|
|
];
|
2023-02-01 19:11:37 +00:00
|
|
|
|
2024-03-12 00:46:29 +00:00
|
|
|
binds.whichKey.register = pushDownDefault {
|
|
|
|
"<leader>l" = "Trouble";
|
|
|
|
"<leader>x" = "+Trouble";
|
|
|
|
"<leader>lw" = "Workspace";
|
|
|
|
};
|
|
|
|
};
|
2023-02-01 19:11:37 +00:00
|
|
|
};
|
|
|
|
}
|