feat(plugins): Add actions-preview-nvim for LSP fixes
This commit is contained in:
parent
e3fd51d189
commit
1ac92922ee
@ -35,6 +35,7 @@ with final.pkgs.lib; let
|
|||||||
|
|
||||||
# nvim-cmp (autocompletion) and extensions
|
# nvim-cmp (autocompletion) and extensions
|
||||||
nvim-cmp # https://github.com/hrsh7th/nvim-cmp
|
nvim-cmp # https://github.com/hrsh7th/nvim-cmp
|
||||||
|
actions-preview-nvim # LSP code actions | https://github.com/aznhe21/actions-preview.nvim
|
||||||
nvim-autopairs # Automatically create closing brackets | https://github.com/windwp/nvim-autopairs
|
nvim-autopairs # Automatically create closing brackets | https://github.com/windwp/nvim-autopairs
|
||||||
cmp_luasnip # snippets autocompletion extension for nvim-cmp | https://github.com/saadparwaiz1/cmp_luasnip/
|
cmp_luasnip # snippets autocompletion extension for nvim-cmp | https://github.com/saadparwaiz1/cmp_luasnip/
|
||||||
lspkind-nvim # vscode-like LSP pictograms | https://github.com/onsails/lspkind.nvim/
|
lspkind-nvim # vscode-like LSP pictograms | https://github.com/onsails/lspkind.nvim/
|
||||||
|
@ -84,39 +84,12 @@ vim.api.nvim_create_autocmd('LspAttach', {
|
|||||||
keymap.set('n', '<M-CR>', vim.lsp.buf.code_action, { desc = '[lsp] code action' })
|
keymap.set('n', '<M-CR>', vim.lsp.buf.code_action, { desc = '[lsp] code action' })
|
||||||
keymap.set('n', '<M-l>', vim.lsp.codelens.run, { desc = '[lsp] run code lens' })
|
keymap.set('n', '<M-l>', vim.lsp.codelens.run, { desc = '[lsp] run code lens' })
|
||||||
keymap.set('n', 'gr', vim.lsp.buf.references, { desc = 'lsp [g]et [r]eferences' })
|
keymap.set('n', 'gr', vim.lsp.buf.references, { desc = 'lsp [g]et [r]eferences' })
|
||||||
--[[ wk.register({
|
|
||||||
l = {
|
|
||||||
name = "[l]sp",
|
|
||||||
g = {
|
|
||||||
name = "[g]o to",
|
|
||||||
t = { "<cmd>vim.lsp.buf.type_definition<cr>", '[l]sp [g]o to [t]ype definition' },
|
|
||||||
},
|
|
||||||
|
|
||||||
p = {
|
|
||||||
name = "[p]eek",
|
|
||||||
d = { peek_definition, '[l]sp [p]eek [d]efinition' },
|
|
||||||
t = { peek_type_definition, '[l]sp [p]eek [t]ype definition' },
|
|
||||||
},
|
|
||||||
|
|
||||||
w = {
|
|
||||||
name = "[w]orkspace",
|
|
||||||
a = { "<cmd>vim.lsp.buf.add_workspace_folder<cr>", '[l]sp add [w]orksp[a]ce folder' },
|
|
||||||
r = { "<cmd>vim.lsp.buf.remove_workspace_folder<cr>", '[l]sp [w]orkspace folder [r]emove' },
|
|
||||||
l = { function() vim.print(vim.lsp.buf.list_workspace_folders()) end, '[l]sp [w]orkspace folders [l]ist' },
|
|
||||||
q = { "<cmd>vim.lsp.buf.workspace_symbol<cr>", '[l]sp [w]orkspace symbol [q]' },
|
|
||||||
},
|
|
||||||
|
|
||||||
r = { "<cmd>vim.lsp.buf.rename<cr>", '[l]sp [r]ename' },
|
|
||||||
d = { "<cmd>vim.lsp.buf.document_symbol<cr>", '[l]sp [d]ocument symbol' },
|
|
||||||
R = { "<cmd>vim.lsp.codelens.refresh<cr>", '[l]sp code lenses [R]efresh' },
|
|
||||||
f = { function() vim.lsp.buf.format { async = true } end, '[l]sp [f]ormat buffer' },
|
|
||||||
},
|
|
||||||
}, { prefix = "<leader>" }) ]]
|
|
||||||
wk.add({
|
wk.add({
|
||||||
{ "<leader>l", group = "[l]sp" },
|
{ "<leader>l", group = "[l]sp" },
|
||||||
{ "<leader>lR", "<cmd>vim.lsp.codelens.refresh<cr>", desc = "[l]sp code lenses [R]efresh" },
|
{ "<leader>lR", "<cmd>vim.lsp.codelens.refresh<cr>", desc = "[l]sp code lenses [R]efresh" },
|
||||||
{ "<leader>ld", "<cmd>vim.lsp.buf.document_symbol<cr>", desc = "[l]sp [d]ocument symbol" },
|
{ "<leader>ld", "<cmd>vim.lsp.buf.document_symbol<cr>", desc = "[l]sp [d]ocument symbol" },
|
||||||
{ "<leader>lf", function() vim.lsp.buf.format { async = true } end, desc = "[l]sp [f]ormat buffer" },
|
{ "<leader>lF", function() vim.lsp.buf.format { async = true } end, desc = "[l]sp [F]ormat buffer" },
|
||||||
{ "<leader>lg", group = "[g]o to" },
|
{ "<leader>lg", group = "[g]o to" },
|
||||||
{ "<leader>lgt", "<cmd>vim.lsp.buf.type_definition<cr>", desc = "[l]sp [g]o to [t]ype definition" },
|
{ "<leader>lgt", "<cmd>vim.lsp.buf.type_definition<cr>", desc = "[l]sp [g]o to [t]ype definition" },
|
||||||
{ "<leader>lp", group = "[p]eek" },
|
{ "<leader>lp", group = "[p]eek" },
|
||||||
|
@ -35,6 +35,8 @@ local function toggle_qf_list()
|
|||||||
end
|
end
|
||||||
|
|
||||||
keymap.set('n', '<C-c>', toggle_qf_list, { desc = 'toggle quickfix list' })
|
keymap.set('n', '<C-c>', toggle_qf_list, { desc = 'toggle quickfix list' })
|
||||||
|
keymap.set({ "v", "n" }, "gf", require("actions-preview").code_actions, { desc = '[l]sp [f]ix'})
|
||||||
|
keymap.set({ "v", "n" }, "<leader>lf", require("actions-preview").code_actions, { desc = '[l]sp [f]ix'})
|
||||||
|
|
||||||
local function try_fallback_notify(opts)
|
local function try_fallback_notify(opts)
|
||||||
local success, _ = pcall(opts.try)
|
local success, _ = pcall(opts.try)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user