2024-07-20 13:51:21 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}: let
|
2024-07-20 14:24:00 +00:00
|
|
|
inherit (lib.modules) mkIf;
|
2024-07-20 13:51:21 +00:00
|
|
|
inherit (lib.nvim.dag) entryAnywhere;
|
|
|
|
inherit (lib.nvim.lua) toLuaObject;
|
2024-07-20 14:24:00 +00:00
|
|
|
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLuaBinding pushDownDefault;
|
2024-07-20 13:51:21 +00:00
|
|
|
|
|
|
|
cfg = config.vim.lsp.code-actions;
|
|
|
|
self = import ./fastaction-nvim.nix {inherit lib;};
|
|
|
|
|
|
|
|
mappingDefinitions = self.options.vim.lsp.code-actions.fastaction-nvim.mappings;
|
|
|
|
mappings = addDescriptionsToMappings cfg.fastaction-nvim.mappings mappingDefinitions;
|
|
|
|
in {
|
|
|
|
config = mkIf (cfg.enable && cfg.fastaction-nvim.enable) {
|
|
|
|
vim = {
|
|
|
|
startPlugins = ["fastaction-nvim"];
|
|
|
|
|
2024-07-20 14:24:00 +00:00
|
|
|
binds.whichKey.register = pushDownDefault {
|
|
|
|
"<leader>c" = "Code Actions";
|
|
|
|
};
|
|
|
|
|
2024-07-20 13:51:21 +00:00
|
|
|
maps = {
|
2024-07-20 14:24:00 +00:00
|
|
|
normal = mkSetLuaBinding mappings.code_action "require('fastaction').code_action";
|
|
|
|
visual = mkSetLuaBinding mappings.range_action "require('fastaction').range_code_action";
|
2024-07-20 13:51:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
pluginRC.fastaction-nvim = entryAnywhere ''
|
|
|
|
-- Enable trouble diagnostics viewer
|
|
|
|
require('fastaction').setup(${toLuaObject cfg.fastaction-nvim.setupOpts})
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|