Skip to content

Commit

Permalink
fix: 使用 lsp 自带 code actions
Browse files Browse the repository at this point in the history
  • Loading branch information
huiwei-menory committed May 21, 2022
1 parent 64341f2 commit b9326e5
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions lua/plugins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,12 @@ return require("packer").startup(function(use)
'<cmd>lua require ("telescope.builtin").lsp_definitions()<cr>',
{ silent = true }
)
vim.api.nvim_set_keymap(
"n",
"<leader>a",
'<cmd>lua require ("telescope.builtin").lsp_code_actions()<cr>',
{ silent = true }
)
-- vim.api.nvim_set_keymap(
-- "n",
-- "<leader>a",
-- "<cmd>lua require('telescope.builtin').lsp_code_actions({layout_strategy='cursor',layout_config={width=50, height = 10}})<cr>",
-- { silent = true }
-- )
vim.api.nvim_set_keymap(
"n",
"<leader>ss",
Expand Down Expand Up @@ -390,6 +390,13 @@ return require("packer").startup(function(use)
{ noremap = true, silent = true }
)
end
vim.api.nvim_buf_set_keymap(
bufnr,
"n",
"<leader>a",
"<cmd>lua vim.lsp.buf.code_action()<CR>",
{ noremap = true, silent = true }
)
end

-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#gopls
Expand Down Expand Up @@ -474,6 +481,12 @@ return require("packer").startup(function(use)
"<cmd>lua require('lspsaga.rename').rename()<CR>",
{ noremap = true, silent = true }
)
-- vim.api.nvim_set_keymap(
-- "n",
-- "<leader>a",
-- "<cmd>lua require('lspsaga.codeaction').code_action()<CR>",
-- { noremap = true, silent = true }
-- )
end,
})
-- https://github.com/j-hui/fidget.nvim
Expand Down

0 comments on commit b9326e5

Please sign in to comment.