✨ feat(nvim): added actions-preview and glance as lsp extras instead of dependencies
had a lot of trouble with the init function...
This commit is contained in:
parent
ba66fa15f2
commit
6b4097cb53
5 changed files with 75 additions and 55 deletions
|
@ -79,11 +79,12 @@
|
|||
"plugins.extras.lang.web.typescript-extended",
|
||||
"plugins.extras.linting.pylint",
|
||||
"plugins.extras.linting.shellcheck",
|
||||
"plugins.extras.lsp.actions-preview",
|
||||
"plugins.extras.lsp.compiler",
|
||||
"plugins.extras.lsp.garbage-day",
|
||||
"plugins.extras.lsp.glance",
|
||||
"plugins.extras.lsp.lens",
|
||||
"plugins.extras.lsp.lightbulb",
|
||||
"plugins.extras.lsp.lsp-extended",
|
||||
"plugins.extras.ui.alpha",
|
||||
"plugins.extras.ui.block",
|
||||
"plugins.extras.ui.breadcrumbs",
|
||||
|
|
34
.config/nvim/lua/plugins/extras/lsp/actions-preview.lua
Normal file
34
.config/nvim/lua/plugins/extras/lsp/actions-preview.lua
Normal file
|
@ -0,0 +1,34 @@
|
|||
return {
|
||||
"aznhe21/actions-preview.nvim",
|
||||
init = function()
|
||||
local keys = require("lazyvim.plugins.lsp.keymaps").get()
|
||||
|
||||
keys[#keys + 1] = { "<leader>ca", false }
|
||||
end,
|
||||
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,
|
||||
},
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
"<leader>ca",
|
||||
function()
|
||||
require("actions-preview").code_actions()
|
||||
end,
|
||||
mode = { "n", "v" },
|
||||
desc = "Code Action Preview",
|
||||
},
|
||||
},
|
||||
}
|
23
.config/nvim/lua/plugins/extras/lsp/glance.lua
Normal file
23
.config/nvim/lua/plugins/extras/lsp/glance.lua
Normal file
|
@ -0,0 +1,23 @@
|
|||
return {
|
||||
"dnlhc/glance.nvim",
|
||||
init = function()
|
||||
local keys = require("lazyvim.plugins.lsp.keymaps").get()
|
||||
|
||||
keys[#keys + 1] = { "gd", false }
|
||||
keys[#keys + 1] = { "gr", false }
|
||||
keys[#keys + 1] = { "gy", false }
|
||||
keys[#keys + 1] = { "gI", false }
|
||||
end,
|
||||
cmd = { "Glance" },
|
||||
opts = {
|
||||
border = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{ "gd", "<CMD>Glance definitions<CR>", desc = "Goto Definition" },
|
||||
{ "gr", "<CMD>Glance references<CR>", desc = "References" },
|
||||
{ "gy", "<CMD>Glance type_definitions<CR>", desc = "Goto t[y]pe definitions" },
|
||||
{ "gI", "<CMD>Glance implementations<CR>", desc = "Goto implementations" },
|
||||
},
|
||||
}
|
|
@ -51,7 +51,13 @@ return {
|
|||
{
|
||||
"Wansmer/symbol-usage.nvim",
|
||||
enabled = false,
|
||||
event = "BufReadPre", -- need run before LspAttach if you use nvim 0.9. On 0.10 use 'LspAttach'
|
||||
event = function()
|
||||
if vim.fn.has("nvim-0.10") == 1 then
|
||||
return "LspAttach"
|
||||
else
|
||||
return "BufRead"
|
||||
end
|
||||
end,
|
||||
opts = {
|
||||
text_format = text_format,
|
||||
},
|
||||
|
|
|
@ -22,13 +22,6 @@ return {
|
|||
init = function()
|
||||
local keys = require("lazyvim.plugins.lsp.keymaps").get()
|
||||
|
||||
keys[#keys + 1] = { "gd", false }
|
||||
keys[#keys + 1] = { "gr", false }
|
||||
keys[#keys + 1] = { "gy", false }
|
||||
keys[#keys + 1] = { "gI", false }
|
||||
|
||||
keys[#keys + 1] = { "<leader>ca", false }
|
||||
|
||||
keys[#keys + 1] = { "<leader>cl", false }
|
||||
keys[#keys + 1] = { "<leader>cil", "<cmd>LspInfo<cr>", desc = "Lsp" }
|
||||
keys[#keys + 1] = { "<leader>uv", toggle_diag_virtext, desc = "Toggle Diagnostic VirtualText" }
|
||||
|
@ -91,7 +84,7 @@ return {
|
|||
},
|
||||
},
|
||||
inlay_hints = {
|
||||
enabled = false,
|
||||
enabled = true,
|
||||
},
|
||||
servers = {
|
||||
lua_ls = {
|
||||
|
@ -152,61 +145,24 @@ 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,
|
||||
},
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
"<leader>ca",
|
||||
function()
|
||||
require("actions-preview").code_actions()
|
||||
end,
|
||||
mode = { "n", "v" },
|
||||
desc = "Code Action Preview",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"smjonas/inc-rename.nvim",
|
||||
cmd = "IncRename",
|
||||
opts = {},
|
||||
},
|
||||
{
|
||||
"dnlhc/glance.nvim",
|
||||
cmd = { "Glance" },
|
||||
opts = {
|
||||
border = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{ "gd", "<CMD>Glance definitions<CR>", desc = "Goto Definition" },
|
||||
{ "gr", "<CMD>Glance references<CR>", desc = "References" },
|
||||
{ "gy", "<CMD>Glance type_definitions<CR>", desc = "Goto t[y]pe definitions" },
|
||||
{ "gI", "<CMD>Glance implementations<CR>", desc = "Goto implementations" },
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"simrat39/rust-tools.nvim",
|
||||
opts = function(_, opts)
|
||||
opts.tools = {
|
||||
inlay_hints = {
|
||||
auto = false,
|
||||
auto = function()
|
||||
if vim.fn.has("nvim-0.10") == 1 then
|
||||
return false
|
||||
else
|
||||
return true
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
||||
end,
|
Loading…
Add table
Reference in a new issue