2023-02-01 19:11:37 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
2023-11-08 02:16:46 +00:00
|
|
|
}: let
|
2024-02-26 03:52:21 +00:00
|
|
|
inherit (lib) addDescriptionsToMappings mkIf mkMerge mkSetBinding nvim 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) {
|
|
|
|
vim.startPlugins = ["trouble"];
|
|
|
|
|
2023-05-02 21:28:40 +00:00
|
|
|
vim.maps.normal = mkMerge [
|
|
|
|
(mkSetBinding mappings.toggle "<cmd>TroubleToggle<CR>")
|
|
|
|
(mkSetBinding mappings.workspaceDiagnostics "<cmd>TroubleToggle workspace_diagnostics<CR>")
|
|
|
|
(mkSetBinding mappings.documentDiagnostics "<cmd>TroubleToggle document_diagnostics<CR>")
|
|
|
|
(mkSetBinding mappings.lspReferences "<cmd>TroubleToggle lsp_references<CR>")
|
|
|
|
(mkSetBinding mappings.quickfix "<cmd>TroubleToggle quickfix<CR>")
|
|
|
|
(mkSetBinding mappings.locList "<cmd>TroubleToggle loclist<CR>")
|
|
|
|
];
|
2023-02-01 19:11:37 +00:00
|
|
|
|
2024-02-26 03:52:21 +00:00
|
|
|
vim.binds.whichKey.register = pushDownDefault {
|
2024-02-25 16:39:05 +00:00
|
|
|
"<leader>l" = "Trouble";
|
|
|
|
"<leader>x" = "+Trouble";
|
|
|
|
"<leader>lw" = "Workspace";
|
|
|
|
};
|
|
|
|
|
2023-02-01 19:11:37 +00:00
|
|
|
vim.luaConfigRC.trouble = nvim.dag.entryAnywhere ''
|
|
|
|
-- Enable trouble diagnostics viewer
|
|
|
|
require("trouble").setup {}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|