2023-02-01 20:11:37 +01:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
2023-11-08 03:16:46 +01:00
|
|
|
}: let
|
2024-03-12 01:46:29 +01:00
|
|
|
inherit (lib.modules) mkIf mkMerge;
|
|
|
|
inherit (lib.strings) optionalString;
|
|
|
|
inherit (lib.nvim.dag) entryAnywhere;
|
|
|
|
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLuaBinding;
|
2023-11-08 03:16:46 +01:00
|
|
|
|
2023-02-01 20:11:37 +01:00
|
|
|
cfg = config.vim.lsp;
|
2023-04-22 19:42:31 +02:00
|
|
|
self = import ./lspsaga.nix {inherit lib;};
|
|
|
|
|
|
|
|
mappingDefinitions = self.options.vim.lsp.lspsaga.mappings;
|
|
|
|
mappings = addDescriptionsToMappings cfg.lspsaga.mappings mappingDefinitions;
|
2023-02-01 20:11:37 +01:00
|
|
|
in {
|
|
|
|
config = mkIf (cfg.enable && cfg.lspsaga.enable) {
|
2024-03-12 01:46:29 +01:00
|
|
|
vim = {
|
|
|
|
startPlugins = ["lspsaga"];
|
|
|
|
|
|
|
|
maps = {
|
|
|
|
visual = mkSetLuaBinding mappings.codeAction "require('lspsaga.codeaction').range_code_action";
|
|
|
|
normal = mkMerge [
|
|
|
|
(mkSetLuaBinding mappings.lspFinder "require('lspsaga.provider').lsp_finder")
|
|
|
|
(mkSetLuaBinding mappings.renderHoveredDoc "require('lspsaga.hover').render_hover_doc")
|
|
|
|
|
|
|
|
(mkSetLuaBinding mappings.smartScrollUp "function() require('lspsaga.action').smart_scroll_with_saga(-1) end")
|
|
|
|
(mkSetLuaBinding mappings.smartScrollDown "function() require('lspsaga.action').smart_scroll_with_saga(1) end")
|
|
|
|
|
|
|
|
(mkSetLuaBinding mappings.rename "require('lspsaga.rename').rename")
|
|
|
|
(mkSetLuaBinding mappings.previewDefinition "require('lspsaga.provider').preview_definition")
|
|
|
|
|
|
|
|
(mkSetLuaBinding mappings.showLineDiagnostics "require('lspsaga.diagnostic').show_line_diagnostics")
|
|
|
|
(mkSetLuaBinding mappings.showCursorDiagnostics "require('lspsaga.diagnostic').show_cursor_diagnostics")
|
|
|
|
|
|
|
|
(mkSetLuaBinding mappings.nextDiagnostic "require('lspsaga.diagnostic').navigate('next')")
|
|
|
|
(mkSetLuaBinding mappings.previousDiagnostic "require('lspsaga.diagnostic').navigate('prev')")
|
|
|
|
|
2024-09-20 17:51:11 +02:00
|
|
|
(mkSetLuaBinding mappings.codeAction "require('lspsaga.codeaction').code_action")
|
2024-03-12 01:46:29 +01:00
|
|
|
(mkIf (!cfg.lspSignature.enable) (mkSetLuaBinding mappings.signatureHelp "require('lspsaga.signaturehelp').signature_help"))
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2024-07-20 10:30:48 +02:00
|
|
|
pluginRC.lspsaga = entryAnywhere ''
|
2024-03-12 01:46:29 +01:00
|
|
|
require('lspsaga').init_lsp_saga({
|
|
|
|
${optionalString config.vim.ui.borders.plugins.lspsaga.enable ''
|
|
|
|
border_style = '${config.vim.ui.borders.plugins.lspsaga.style}',
|
|
|
|
''}
|
|
|
|
})
|
|
|
|
'';
|
|
|
|
};
|
2023-02-01 20:11:37 +01:00
|
|
|
};
|
|
|
|
}
|