fastaction: move to vim.ui, remove mappings, enable register_ui_select by default

This commit is contained in:
diniamo 2024-09-19 19:55:57 +02:00
parent 7e8a53bc03
commit 24b4902913
10 changed files with 35 additions and 74 deletions

View file

@ -21,12 +21,6 @@ isMaximal: {
lspSignature.enable = true;
lsplines.enable = isMaximal;
nvim-docs-view.enable = isMaximal;
# Code Actions
code-actions = {
enable = true;
fastaction-nvim.enable = true;
};
};
debugger = {
@ -209,6 +203,7 @@ isMaximal: {
go = ["90" "130"];
};
};
fastaction.enable = true;
};
assistant = {

View file

@ -10,9 +10,9 @@ in {
# 2024-07-20
(mkRemovedOptionModule ["vim" "lsp" "nvimCodeActionMenu"] ''
nvimCodeActionMenu has been deprecated and archived upstream. As of 0.7, code-actions will be
available under `vim.lsp.code-actions.enable` and `vim.lsp.code.actions.<plugin>.enable`.
Please take a look at the nvf manual for more details.
nvimCodeActionMenu has been deprecated and archived upstream. As of 0.7, fastaction will be
available under `vim.ui.fastaction` as a replacement. Please take a look at the nvf manual
for more details.
'')
];
}

View file

@ -1,10 +0,0 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption;
in {
imports = [
./fastaction-nvim
];
options.vim.lsp.code-actions = {
enable = mkEnableOption "code-actions. Setting this to `false` will disable all code action plugins.";
};
}

View file

@ -1,36 +0,0 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLuaBinding pushDownDefault;
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"];
binds.whichKey.register = pushDownDefault {
"<leader>c" = "Code Actions";
};
maps = {
normal = mkSetLuaBinding mappings.code_action "require('fastaction').code_action";
visual = mkSetLuaBinding mappings.range_action "require('fastaction').range_code_action";
};
pluginRC.fastaction-nvim = entryAnywhere ''
-- Enable trouble diagnostics viewer
require('fastaction').setup(${toLuaObject cfg.fastaction-nvim.setupOpts})
'';
};
};
}

View file

@ -1,15 +0,0 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption;
inherit (lib.nvim.types) mkPluginSetupOption;
inherit (lib.nvim.binds) mkMappingOption;
in {
options.vim.lsp.code-actions.fastaction-nvim = {
enable = mkEnableOption "code actions for Neovim via fastaction.nvim";
setupOpts = mkPluginSetupOption "fastaction-nvim" {};
mappings = {
code_action = mkMappingOption "Displays code action popup [Fastaction.nvim]" "<leader>cfa";
range_action = mkMappingOption " Displays code actions for visual range [Fastaction.nvim]" "<leader>cra";
};
};
}

View file

@ -16,8 +16,5 @@
./lspkind
./lsplines
./nvim-docs-view
# Code Actions
./code-actions
];
}

View file

@ -8,5 +8,6 @@
./illuminate
./breadcrumbs
./borders
./fastaction
];
}

View file

@ -0,0 +1,20 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf mkDefault;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.ui.fastaction;
in {
config = mkIf cfg.enable {
vim = {
ui.fastaction.setupOpts.register_ui_select = mkDefault true;
startPlugins = ["fastaction-nvim"];
pluginRC.fastaction-nvim = entryAnywhere "require('fastaction').setup(${toLuaObject cfg.setupOpts})";
};
};
}

View file

@ -1,6 +1,6 @@
{
imports = [
./config.nix
./fastaction-nvim.nix
./config.nix
];
}

View file

@ -0,0 +1,9 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption;
inherit (lib.nvim.types) mkPluginSetupOption;
in {
options.vim.ui.fastaction = {
enable = mkEnableOption "overriding vim.ui.select with fastaction.nvim";
setupOpts = mkPluginSetupOption "fastaction" {};
};
}