diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index ed801968..b4a87c64 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -117,7 +117,6 @@ "rest.nvim": { "branch": "main", "commit": "b8d6c0a8762fd374e0204768a94241135ca3e311" }, "rust-tools.nvim": { "branch": "master", "commit": "0cc8adab23117783a0292a0c8a2fbed1005dc645" }, "satellite.nvim": { "branch": "main", "commit": "7911fa8137c77258ba509ba875ea52c6d59737e8" }, - "scope.nvim": { "branch": "main", "commit": "cd27af77ad61a7199af5c28d27013fb956eb0e3e" }, "semshi": { "branch": "master", "commit": "50f9d74ee160e539c5662cbde5c3b0ccd4e27fb3" }, "smart-splits.nvim": { "branch": "master", "commit": "c8a9173d70cbbd1f6e4a414e49e31df2b32a1362" }, "sniprun": { "branch": "master", "commit": "0ad935699a5e24ca3a0aa621c7425ac7029775b3" }, diff --git a/.config/nvim/lazyvim.json b/.config/nvim/lazyvim.json index e141ed68..16ed04d1 100644 --- a/.config/nvim/lazyvim.json +++ b/.config/nvim/lazyvim.json @@ -48,7 +48,6 @@ "plugins.extras.lang.markdown", "plugins.extras.lang.typescript", "plugins.extras.lang.web", - "plugins.extras.lsp.actions-preview", "plugins.extras.lsp.compiler", "plugins.extras.lsp.lightbulb", "plugins.extras.lsp.lsp", diff --git a/.config/nvim/lua/plugins/extras/lsp/actions-preview.lua b/.config/nvim/lua/plugins/extras/lsp/actions-preview.lua deleted file mode 100644 index cc2eed7b..00000000 --- a/.config/nvim/lua/plugins/extras/lsp/actions-preview.lua +++ /dev/null @@ -1,28 +0,0 @@ -return { - { - "aznhe21/actions-preview.nvim", - event = "BufRead", - opts = { - telescope = { - sorting_strategy = "ascending", - layout_strategy = "vertical", - layout_config = { - width = 0.8, - height = 0.9, - prompt_position = "top", - preview_cutoff = 20, - preview_height = function(_, _, max_lines) - return max_lines - 15 - end, - }, - }, - }, - }, - { - "neovim/nvim-lspconfig", - init = function() - local keys = require("lazyvim.plugins.lsp.keymaps").get() - keys[#keys + 1] = { "ca", require("actions-preview").code_actions, desc = "Code Action Preview" } - end, - }, -} diff --git a/.config/nvim/lua/plugins/extras/lsp/lightbulb.lua b/.config/nvim/lua/plugins/extras/lsp/lightbulb.lua index d6b2fc91..681eb35f 100644 --- a/.config/nvim/lua/plugins/extras/lsp/lightbulb.lua +++ b/.config/nvim/lua/plugins/extras/lsp/lightbulb.lua @@ -1,19 +1,12 @@ return { "kosayoda/nvim-lightbulb", - event = "BufReadPre", + event = "LspAttach", opts = { - sign = { - enabled = false, - priority = 10, - }, - float = { - enabled = true, - text = "💡", - win_opts = {}, - }, - virtual_text = { - enabled = false, - text = "💡", + autocmd = { enabled = true }, + sign = { enabled = true, text = "" }, + action_kinds = { "quickfix", "refactor" }, + ignore = { + actions_without_kind = true, }, }, } diff --git a/.config/nvim/lua/plugins/extras/lsp/lsp.lua b/.config/nvim/lua/plugins/extras/lsp/lsp.lua index 40b2f79e..a046e906 100644 --- a/.config/nvim/lua/plugins/extras/lsp/lsp.lua +++ b/.config/nvim/lua/plugins/extras/lsp/lsp.lua @@ -1,3 +1,21 @@ +local function toggle_diag_virtext() + local virtual_text = { -- Default virtual_text opts from Lazy.Nvim + spacing = 4, + source = "if_many", + prefix = "●", + } + local config = vim.diagnostic.config() + if type(config.virtual_text) == "table" then + config.virtual_text = false + vim.diagnostic.config(config) + vim.notify("Disable diagnostics virtualtext", 5, { title = "Diagnostics" }) + else + config.virtual_text = virtual_text + vim.diagnostic.config(config) + vim.notify("Enabled diagnostics virtualtext", 5, { title = "Diagnostics" }) + end +end + return { { "neovim/nvim-lspconfig", @@ -7,8 +25,12 @@ return { keys[#keys + 1] = { "gr", "Glance references", desc = "References" } keys[#keys + 1] = { "gy", "Glance type_definitions", desc = "Goto t[y]pe definitions" } keys[#keys + 1] = { "gI", "Glance implementations", desc = "Goto implementations" } + + keys[#keys + 1] = { "ca", require("actions-preview").code_actions, desc = "Code Action Preview" } + keys[#keys + 1] = { "cl", false } keys[#keys + 1] = { "cli", "LspInfo", desc = "LspInfo" } + keys[#keys + 1] = { "uv", toggle_diag_virtext, desc = "Toggle Diagnostic VirtualText" } keys[#keys + 1] = { "cll", @@ -132,6 +154,25 @@ return { }, }, }, + { + "aznhe21/actions-preview.nvim", + event = "LspAttach", + opts = { + telescope = { + sorting_strategy = "ascending", + layout_strategy = "vertical", + layout_config = { + width = 0.8, + height = 0.9, + prompt_position = "top", + preview_cutoff = 20, + preview_height = function(_, _, max_lines) + return max_lines - 15 + end, + }, + }, + }, + }, { "dnlhc/glance.nvim", cmd = { "Glance" }, @@ -154,7 +195,7 @@ return { }, { "hinell/lsp-timeout.nvim", - event = "BufRead", + event = "LspAttach", enabled = false, dependencies = { "neovim/nvim-lspconfig" }, init = function()