mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-11-07 16:05:58 +01:00
fastaction: add module (#376)
* plugins/lsp: add code-actions module; add fastaction.nvim * deprecate nvimCodeActionMenu * fastaction-nvim: move range_code_action to visual maps * fastaction: move to vim.ui, remove mappings, enable register_ui_select by default * fastaction: add missing documentation * fastaction: support vim.ui.borders * treewide: clean up nvim-code-action-menu remnants * docs: add missing section ids --------- Co-authored-by: NotAShelf <raf@notashelf.dev>
This commit is contained in:
parent
e40d7a2a56
commit
99ace503ad
17 changed files with 80 additions and 86 deletions
|
@ -17,7 +17,6 @@ isMaximal: {
|
|||
lspkind.enable = false;
|
||||
lightbulb.enable = true;
|
||||
lspsaga.enable = false;
|
||||
nvimCodeActionMenu.enable = isMaximal;
|
||||
trouble.enable = true;
|
||||
lspSignature.enable = true;
|
||||
lsplines.enable = isMaximal;
|
||||
|
@ -204,6 +203,7 @@ isMaximal: {
|
|||
go = ["90" "130"];
|
||||
};
|
||||
};
|
||||
fastaction.enable = true;
|
||||
};
|
||||
|
||||
assistant = {
|
||||
|
|
|
@ -4,6 +4,8 @@ Release notes for release 0.7
|
|||
|
||||
## Breaking Changes and Migration Guide {#sec-breaking-changes-and-migration-guide-0-7}
|
||||
|
||||
### `vim.configRC` removed {#sec-vim-configrc-removed}
|
||||
|
||||
In v0.7 we are removing `vim.configRC` in favor of making `vim.luaConfigRC` the
|
||||
top-level DAG, and thereby making the entire configuration Lua based. This
|
||||
change introduces a few breaking changes:
|
||||
|
@ -24,6 +26,17 @@ making good use of its extensive Lua API. Additionally, Vimscript is slow and
|
|||
brings unnecessary performance overhead while working with different
|
||||
configuration formats.
|
||||
|
||||
### `vim.lsp.nvimCodeActionMenu` removed in favor of `vim.ui.fastaction` {#sec-nvim-code-action-menu-deprecation}
|
||||
|
||||
The nvim-code-action-menu plugin has been archived and broken for a long time,
|
||||
so it's being replaced with a young, but better alternative called
|
||||
fastaction.nvim. Simply remove everything set under
|
||||
`vim.lsp.nvimCodeActionMenu`, and set `vim.ui.fastaction.enable` to `true`.
|
||||
|
||||
Note that we are looking to add more alternatives in the future like
|
||||
dressing.nvim and actions-preview.nvim, in case fastaction doesn't work for
|
||||
everyone.
|
||||
|
||||
## Changelog {#sec-release-0.7-changelog}
|
||||
|
||||
[ItsSorae](https://github.com/ItsSorae):
|
||||
|
@ -103,6 +116,9 @@ configuration formats.
|
|||
yourself by adding `vim.opt.listchars:append({ eol = '<char>' })` to your
|
||||
lua configuration
|
||||
|
||||
- Replace `vim.lsp.nvimCodeActionMenu` with `vim.ui.fastaction`, see the
|
||||
breaking changes section above for more details
|
||||
|
||||
[Neovim documentation on `vim.cmd`]: https://neovim.io/doc/user/lua.html#vim.cmd()
|
||||
|
||||
- Make Neovim's configuration file entirely Lua based. This comes with a few
|
||||
|
|
34
flake.lock
34
flake.lock
|
@ -571,6 +571,22 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"plugin-fastaction-nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1721396662,
|
||||
"narHash": "sha256-L7na78FsE+QHlEwxMpiwQcoOPhtmrknvdTZfzUoDANI=",
|
||||
"owner": "Chaitanyabsprip",
|
||||
"repo": "fastaction.nvim",
|
||||
"rev": "2384dea7ba81d2709d0bee0e4bc7a8831ff13a9d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "Chaitanyabsprip",
|
||||
"repo": "fastaction.nvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"plugin-fidget-nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
@ -1052,22 +1068,6 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"plugin-nvim-code-action-menu": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1702287297,
|
||||
"narHash": "sha256-pY+aP9iBuJhvDZzVEsOHZmnfaq3vUP7TfKEEQrj+Mo8=",
|
||||
"owner": "weilbith",
|
||||
"repo": "nvim-code-action-menu",
|
||||
"rev": "8c7672a4b04d3cc4edd2c484d05b660a9cb34a1b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "weilbith",
|
||||
"repo": "nvim-code-action-menu",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"plugin-nvim-colorizer-lua": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
@ -1855,6 +1855,7 @@
|
|||
"plugin-dracula": "plugin-dracula",
|
||||
"plugin-dressing-nvim": "plugin-dressing-nvim",
|
||||
"plugin-elixir-tools": "plugin-elixir-tools",
|
||||
"plugin-fastaction-nvim": "plugin-fastaction-nvim",
|
||||
"plugin-fidget-nvim": "plugin-fidget-nvim",
|
||||
"plugin-flutter-tools": "plugin-flutter-tools",
|
||||
"plugin-gesture-nvim": "plugin-gesture-nvim",
|
||||
|
@ -1885,7 +1886,6 @@
|
|||
"plugin-nvim-autopairs": "plugin-nvim-autopairs",
|
||||
"plugin-nvim-bufferline-lua": "plugin-nvim-bufferline-lua",
|
||||
"plugin-nvim-cmp": "plugin-nvim-cmp",
|
||||
"plugin-nvim-code-action-menu": "plugin-nvim-code-action-menu",
|
||||
"plugin-nvim-colorizer-lua": "plugin-nvim-colorizer-lua",
|
||||
"plugin-nvim-cursorline": "plugin-nvim-cursorline",
|
||||
"plugin-nvim-dap": "plugin-nvim-dap",
|
||||
|
|
|
@ -133,8 +133,8 @@
|
|||
flake = false;
|
||||
};
|
||||
|
||||
plugin-nvim-code-action-menu = {
|
||||
url = "github:weilbith/nvim-code-action-menu";
|
||||
plugin-fastaction-nvim = {
|
||||
url = "github:Chaitanyabsprip/fastaction.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
|
|
|
@ -67,7 +67,6 @@ in {
|
|||
formatOnSave = true;
|
||||
lightbulb.enable = true;
|
||||
lspsaga.enable = false;
|
||||
nvimCodeActionMenu.enable = true;
|
||||
trouble.enable = true;
|
||||
lspSignature.enable = true;
|
||||
rust.enable = false;
|
||||
|
|
|
@ -67,7 +67,6 @@ in {
|
|||
formatOnSave = true;
|
||||
lightbulb.enable = true;
|
||||
lspsaga.enable = false;
|
||||
nvimCodeActionMenu.enable = true;
|
||||
trouble.enable = true;
|
||||
lspSignature.enable = true;
|
||||
rust.enable = false;
|
||||
|
|
|
@ -7,5 +7,12 @@ in {
|
|||
Tidalcycles language support has been removed as of 2024-06-06 as it was long unmaintained. If
|
||||
you depended on this functionality, please open an issue.
|
||||
'')
|
||||
|
||||
# 2024-07-20
|
||||
(mkRemovedOptionModule ["vim" "lsp" "nvimCodeActionMenu"] ''
|
||||
nvimCodeActionMenu has been deprecated and removed upstream. As of 0.7, fastaction will be
|
||||
available under `vim.ui.fastaction` as a replacement. Simply remove everything under
|
||||
`vim.lsp.nvimCodeActionMenu`, and set `vim.ui.fastaction.enable` to `true`.
|
||||
'')
|
||||
];
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
# lsp plugins
|
||||
./lspsaga
|
||||
./nvim-code-action-menu
|
||||
./trouble
|
||||
./lsp-signature
|
||||
./lightbulb
|
||||
|
|
|
@ -36,7 +36,7 @@ in {
|
|||
(mkSetLuaBinding mappings.nextDiagnostic "require('lspsaga.diagnostic').navigate('next')")
|
||||
(mkSetLuaBinding mappings.previousDiagnostic "require('lspsaga.diagnostic').navigate('prev')")
|
||||
|
||||
(mkIf (!cfg.nvimCodeActionMenu.enable) (mkSetLuaBinding mappings.codeAction "require('lspsaga.codeaction').code_action"))
|
||||
(mkSetLuaBinding mappings.codeAction "require('lspsaga.codeaction').code_action")
|
||||
(mkIf (!cfg.lspSignature.enable) (mkSetLuaBinding mappings.signatureHelp "require('lspsaga.signaturehelp').signature_help"))
|
||||
];
|
||||
};
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.binds) mkSetBinding addDescriptionsToMappings pushDownDefault;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.lsp;
|
||||
|
||||
self = import ./nvim-code-action-menu.nix {inherit lib;};
|
||||
mappingDefinitions = self.options.vim.lsp.nvimCodeActionMenu.mappings;
|
||||
mappings = addDescriptionsToMappings cfg.nvimCodeActionMenu.mappings mappingDefinitions;
|
||||
in {
|
||||
config = mkIf (cfg.enable && cfg.nvimCodeActionMenu.enable) {
|
||||
vim = {
|
||||
startPlugins = ["nvim-code-action-menu"];
|
||||
|
||||
maps.normal = mkSetBinding mappings.open ":CodeActionMenu<CR>";
|
||||
|
||||
binds.whichKey.register = pushDownDefault {
|
||||
"<leader>c" = "+CodeAction";
|
||||
};
|
||||
|
||||
pluginRC.code-action-menu = entryAnywhere ''
|
||||
-- border configuration
|
||||
vim.g.code_action_menu_window_border = ${toLuaObject config.vim.ui.borders.plugins.code-action-menu.style}
|
||||
|
||||
-- show individual sections of the code action menu
|
||||
${lib.optionalString cfg.nvimCodeActionMenu.show.details "vim.g.code_action_menu_show_details = true"}
|
||||
${lib.optionalString cfg.nvimCodeActionMenu.show.diff "vim.g.code_action_menu_show_diff = true"}
|
||||
${lib.optionalString cfg.nvimCodeActionMenu.show.actionKind "vim.g.code_action_menu_show_action_kind = true"}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
in {
|
||||
options.vim.lsp = {
|
||||
nvimCodeActionMenu = {
|
||||
enable = mkEnableOption "nvim code action menu";
|
||||
|
||||
show = {
|
||||
details = mkEnableOption "Show details" // {default = true;};
|
||||
diff = mkEnableOption "Show diff" // {default = true;};
|
||||
actionKind = mkEnableOption "Show action kind" // {default = true;};
|
||||
};
|
||||
|
||||
mappings = {
|
||||
open = mkMappingOption "Open code action menu [nvim-code-action-menu]" "<leader>ca";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -43,7 +43,7 @@ in {
|
|||
lspsaga = mkPluginStyleOption "lspsaga";
|
||||
nvim-cmp = mkPluginStyleOption "nvim-cmp";
|
||||
lsp-signature = mkPluginStyleOption "lsp-signature";
|
||||
code-action-menu = mkPluginStyleOption "code-actions-menu";
|
||||
fastaction = mkPluginStyleOption "fastaction";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -8,5 +8,6 @@
|
|||
./illuminate
|
||||
./breadcrumbs
|
||||
./borders
|
||||
./fastaction
|
||||
];
|
||||
}
|
||||
|
|
24
modules/plugins/ui/fastaction/config.nix
Normal file
24
modules/plugins/ui/fastaction/config.nix
Normal file
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf mkDefault;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.ui.fastaction;
|
||||
borderCfg = config.vim.ui.borders.plugins.fastaction;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
ui.fastaction.setupOpts = {
|
||||
register_ui_select = mkDefault true;
|
||||
popup.border = mkIf borderCfg.enable borderCfg.style;
|
||||
};
|
||||
|
||||
startPlugins = ["fastaction-nvim"];
|
||||
pluginRC.fastaction = entryAnywhere "require('fastaction').setup(${toLuaObject cfg.setupOpts})";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./nvim-code-action-menu.nix
|
||||
./fastaction-nvim.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
9
modules/plugins/ui/fastaction/fastaction-nvim.nix
Normal file
9
modules/plugins/ui/fastaction/fastaction-nvim.nix
Normal 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" {};
|
||||
};
|
||||
}
|
|
@ -45,8 +45,6 @@ in {
|
|||
'noice',
|
||||
'NvimTree',
|
||||
'alpha',
|
||||
'code-action-menu-menu',
|
||||
'code-action-menu-warning-message',
|
||||
'notify',
|
||||
'Navbuddy'
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue