mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-26 15:06:45 +00:00
plugins/lsp: add code-actions module; add fastaction.nvim
This commit is contained in:
parent
2b8d0af2e6
commit
346e6f535e
6 changed files with 84 additions and 1 deletions
17
flake.lock
17
flake.lock
|
@ -571,6 +571,22 @@
|
||||||
"type": "github"
|
"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": {
|
"plugin-fidget-nvim": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -1839,6 +1855,7 @@
|
||||||
"plugin-dracula": "plugin-dracula",
|
"plugin-dracula": "plugin-dracula",
|
||||||
"plugin-dressing-nvim": "plugin-dressing-nvim",
|
"plugin-dressing-nvim": "plugin-dressing-nvim",
|
||||||
"plugin-elixir-tools": "plugin-elixir-tools",
|
"plugin-elixir-tools": "plugin-elixir-tools",
|
||||||
|
"plugin-fastaction-nvim": "plugin-fastaction-nvim",
|
||||||
"plugin-fidget-nvim": "plugin-fidget-nvim",
|
"plugin-fidget-nvim": "plugin-fidget-nvim",
|
||||||
"plugin-flutter-tools": "plugin-flutter-tools",
|
"plugin-flutter-tools": "plugin-flutter-tools",
|
||||||
"plugin-gesture-nvim": "plugin-gesture-nvim",
|
"plugin-gesture-nvim": "plugin-gesture-nvim",
|
||||||
|
|
|
@ -138,6 +138,11 @@
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
plugin-fastaction-nvim = {
|
||||||
|
url = "github:Chaitanyabsprip/fastaction.nvim";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
plugin-lsp-signature = {
|
plugin-lsp-signature = {
|
||||||
url = "github:ray-x/lsp_signature.nvim";
|
url = "github:ray-x/lsp_signature.nvim";
|
||||||
flake = false;
|
flake = false;
|
||||||
|
|
10
modules/plugins/lsp/code-actions/default.nix
Normal file
10
modules/plugins/lsp/code-actions/default.nix
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{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.";
|
||||||
|
};
|
||||||
|
}
|
34
modules/plugins/lsp/code-actions/fastaction-nvim/config.nix
Normal file
34
modules/plugins/lsp/code-actions/fastaction-nvim/config.nix
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLuaBinding;
|
||||||
|
|
||||||
|
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"];
|
||||||
|
|
||||||
|
maps = {
|
||||||
|
normal = mkMerge [
|
||||||
|
(mkSetLuaBinding mappings.code_action "require('fastaction').code_action")
|
||||||
|
(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})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
{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";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -10,12 +10,14 @@
|
||||||
|
|
||||||
# lsp plugins
|
# lsp plugins
|
||||||
./lspsaga
|
./lspsaga
|
||||||
./nvim-code-action-menu
|
|
||||||
./trouble
|
./trouble
|
||||||
./lsp-signature
|
./lsp-signature
|
||||||
./lightbulb
|
./lightbulb
|
||||||
./lspkind
|
./lspkind
|
||||||
./lsplines
|
./lsplines
|
||||||
./nvim-docs-view
|
./nvim-docs-view
|
||||||
|
|
||||||
|
# Code Actions
|
||||||
|
./code-actions
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue