summaryrefslogtreecommitdiff
path: root/lua/core
diff options
context:
space:
mode:
authorAbouzar Parvan <[email protected]>2021-10-06 02:07:23 +0330
committerGitHub <[email protected]>2021-10-06 02:07:23 +0330
commit0ad60e90a9b0dd557df10f73bec344e88549a9d7 (patch)
treed1eb9382eae359e8585354870e022cdd32c12f9e /lua/core
parent5fe7b7ad4d6fa699ca9cc306a788d6485fc0ba8d (diff)
[Feature] better code action prompt and auto show codelens actions (#1698)
Diffstat (limited to 'lua/core')
-rw-r--r--lua/core/telescope.lua20
-rw-r--r--lua/core/which-key.lua3
2 files changed, 22 insertions, 1 deletions
diff --git a/lua/core/telescope.lua b/lua/core/telescope.lua
index eba27eec..0fb735fa 100644
--- a/lua/core/telescope.lua
+++ b/lua/core/telescope.lua
@@ -159,6 +159,26 @@ function M.view_lunarvim_changelog()
}):find()
end
+function M.code_actions()
+ local opts = {
+ winblend = 15,
+ layout_config = {
+ prompt_position = "top",
+ width = 80,
+ height = 12,
+ },
+ borderchars = {
+ prompt = { "─", "│", " ", "│", "╭", "╮", "│", "│" },
+ results = { "─", "│", "─", "│", "├", "┤", "╯", "╰" },
+ preview = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
+ },
+ border = {},
+ previewer = false,
+ shorten_path = false,
+ }
+ require("telescope.builtin").lsp_code_actions(require("telescope.themes").get_dropdown(opts))
+end
+
function M.setup()
local telescope = require "telescope"
diff --git a/lua/core/which-key.lua b/lua/core/which-key.lua
index a115bcc5..c9e9b2f4 100644
--- a/lua/core/which-key.lua
+++ b/lua/core/which-key.lua
@@ -139,7 +139,7 @@ M.config = function()
l = {
name = "LSP",
- a = { "<cmd>lua vim.lsp.buf.code_action()<cr>", "Code Action" },
+ a = { "<cmd>lua require('core.telescope').code_actions()<cr>", "Code Action" },
d = {
"<cmd>Telescope lsp_document_diagnostics<cr>",
"Document Diagnostics",
@@ -159,6 +159,7 @@ M.config = function()
"<cmd>lua vim.lsp.diagnostic.goto_prev({popup_opts = {border = lvim.lsp.popup_border}})<cr>",
"Prev Diagnostic",
},
+ l = { "<cmd>lua vim.lsp.codelens.run()<cr>", "CodeLens Action" },
p = {
name = "Peek",
d = { "<cmd>lua require('lsp.peek').Peek('definition')<cr>", "Definition" },