From 69ecb964c10c1c33ce415a3e6c1f7dcaece9e779 Mon Sep 17 00:00:00 2001 From: manuuurino <2855338+manuuurino@users.noreply.github.com> Date: Tue, 9 Apr 2024 20:34:29 +0200 Subject: [PATCH 1/3] feat(lsp): add `actions-preview.nvim` plugin --- .../lsp/actions-preview-nvim/README.md | 5 ++++ .../lsp/actions-preview-nvim/init.lua | 28 +++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 lua/astrocommunity/lsp/actions-preview-nvim/README.md create mode 100644 lua/astrocommunity/lsp/actions-preview-nvim/init.lua diff --git a/lua/astrocommunity/lsp/actions-preview-nvim/README.md b/lua/astrocommunity/lsp/actions-preview-nvim/README.md new file mode 100644 index 000000000..12e45e715 --- /dev/null +++ b/lua/astrocommunity/lsp/actions-preview-nvim/README.md @@ -0,0 +1,5 @@ +# Actions Preview + +Fully customizable previewer for LSP code actions. + +**Repository:** diff --git a/lua/astrocommunity/lsp/actions-preview-nvim/init.lua b/lua/astrocommunity/lsp/actions-preview-nvim/init.lua new file mode 100644 index 000000000..9b11fcc8c --- /dev/null +++ b/lua/astrocommunity/lsp/actions-preview-nvim/init.lua @@ -0,0 +1,28 @@ +local keymaps = { + ["la"] = { + function() require("actions-preview").code_actions() end, + desc = "LSP code action", + cond = "testDocument/codeAction", + }, +} + +local mappings = { + n = keymaps, + v = keymaps, +} + +---@type LazySpec +return { + "aznhe21/actions-preview.nvim", + event = "User AstroLspSetup", + dependencies = { + "nvim-telescope/telescope.nvim", + { + "AstroNvim/astrolsp", + ---@type AstroLSPOpts + opts = { + mappings = mappings, + }, + }, + }, +} From 004e79ecfd8b44a96e7f76cd590248d90b02ddb1 Mon Sep 17 00:00:00 2001 From: Uzair Aftab <48220549+Uzaaft@users.noreply.github.com> Date: Wed, 10 Apr 2024 17:05:06 +0200 Subject: [PATCH 2/3] feat(actions-preview-nvim): Lazy load plugin Co-authored-by: Micah Halter --- lua/astrocommunity/lsp/actions-preview-nvim/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/astrocommunity/lsp/actions-preview-nvim/init.lua b/lua/astrocommunity/lsp/actions-preview-nvim/init.lua index 9b11fcc8c..4b423cd67 100644 --- a/lua/astrocommunity/lsp/actions-preview-nvim/init.lua +++ b/lua/astrocommunity/lsp/actions-preview-nvim/init.lua @@ -14,7 +14,7 @@ local mappings = { ---@type LazySpec return { "aznhe21/actions-preview.nvim", - event = "User AstroLspSetup", + lazy = true, dependencies = { "nvim-telescope/telescope.nvim", { From 4fa401c729f50905f9a97eaa079991f767dfdea0 Mon Sep 17 00:00:00 2001 From: manuuurino <2855338+manuuurino@users.noreply.github.com> Date: Wed, 10 Apr 2024 18:57:38 +0200 Subject: [PATCH 3/3] refactor(actions-preview-nvim): made mapping smaller --- .../lsp/actions-preview-nvim/init.lua | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/lua/astrocommunity/lsp/actions-preview-nvim/init.lua b/lua/astrocommunity/lsp/actions-preview-nvim/init.lua index 4b423cd67..e9b405869 100644 --- a/lua/astrocommunity/lsp/actions-preview-nvim/init.lua +++ b/lua/astrocommunity/lsp/actions-preview-nvim/init.lua @@ -1,16 +1,3 @@ -local keymaps = { - ["la"] = { - function() require("actions-preview").code_actions() end, - desc = "LSP code action", - cond = "testDocument/codeAction", - }, -} - -local mappings = { - n = keymaps, - v = keymaps, -} - ---@type LazySpec return { "aznhe21/actions-preview.nvim", @@ -21,7 +8,22 @@ return { "AstroNvim/astrolsp", ---@type AstroLSPOpts opts = { - mappings = mappings, + mappings = { + n = { + ["la"] = { + function() require("actions-preview").code_actions() end, + desc = "LSP code action", + cond = "testDocument/codeAction", + }, + }, + v = { + ["la"] = { + function() require("actions-preview").code_actions() end, + desc = "LSP code action", + cond = "testDocument/codeAction", + }, + }, + }, }, }, },