Skip to content

Commit

Permalink
fastaction: add module (#376)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
diniamo and NotAShelf authored Sep 20, 2024
1 parent e40d7a2 commit 99ace50
Show file tree
Hide file tree
Showing 17 changed files with 80 additions and 86 deletions.
2 changes: 1 addition & 1 deletion configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -204,6 +203,7 @@ isMaximal: {
go = ["90" "130"];
};
};
fastaction.enable = true;
};

assistant = {
Expand Down
16 changes: 16 additions & 0 deletions docs/release-notes/rl-0.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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):
Expand Down Expand Up @@ -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
Expand Down
34 changes: 17 additions & 17 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down
1 change: 0 additions & 1 deletion flake/modules/home-manager.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion flake/modules/nixos.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 7 additions & 0 deletions modules/extra/deprecations.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
'')
];
}
1 change: 0 additions & 1 deletion modules/plugins/lsp/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

# lsp plugins
./lspsaga
./nvim-code-action-menu
./trouble
./lsp-signature
./lightbulb
Expand Down
2 changes: 1 addition & 1 deletion modules/plugins/lsp/lspsaga/config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
];
};
Expand Down
38 changes: 0 additions & 38 deletions modules/plugins/lsp/nvim-code-action-menu/config.nix

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion modules/plugins/ui/borders/borders.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
};
};
}
1 change: 1 addition & 0 deletions modules/plugins/ui/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
./illuminate
./breadcrumbs
./borders
./fastaction
];
}
24 changes: 24 additions & 0 deletions modules/plugins/ui/fastaction/config.nix
Original file line number Diff line number Diff line change
@@ -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})";
};
};
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
imports = [
./nvim-code-action-menu.nix
./fastaction-nvim.nix
./config.nix
];
}
9 changes: 9 additions & 0 deletions modules/plugins/ui/fastaction/fastaction-nvim.nix
Original file line number Diff line number Diff line change
@@ -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" {};
};
}
2 changes: 0 additions & 2 deletions modules/plugins/visuals/config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ in {
'noice',
'NvimTree',
'alpha',
'code-action-menu-menu',
'code-action-menu-warning-message',
'notify',
'Navbuddy'
},
Expand Down

0 comments on commit 99ace50

Please sign in to comment.