mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
refactor(rust-tools): check for client name and use different keymaps to not interfere with cmp for <C-space>
This commit is contained in:
parent
2d4fe35af1
commit
c9c6bc56f0
1 changed files with 8 additions and 10 deletions
|
|
@ -11,16 +11,7 @@ return {
|
|||
-- correctly setup lspconfig for Rust 🚀
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
"simrat39/rust-tools.nvim",
|
||||
init = function()
|
||||
require("lazyvim.util").on_attach(function(_, buffer)
|
||||
-- stylua: ignore
|
||||
vim.keymap.set("n", "<C-space>", "RustHoverActions", { buffer = buffer, desc = "Hover Actions (Rust)" })
|
||||
vim.keymap.set("n", "<Leader>a", "RustCodeActionGroup", { buffer = buffer, desc = "Code Action (Rust)" })
|
||||
end)
|
||||
end,
|
||||
},
|
||||
dependencies = { "simrat39/rust-tools.nvim" },
|
||||
opts = {
|
||||
servers = {
|
||||
rust_analyzer = {
|
||||
|
|
@ -47,6 +38,13 @@ return {
|
|||
},
|
||||
setup = {
|
||||
rust_analyzer = function(_, opts)
|
||||
require("lazyvim.util").on_attach(function(client, buffer)
|
||||
if client.name == "rust_analyzer" then
|
||||
-- stylua: ignore
|
||||
vim.keymap.set("n", "<leader>co", "RustHoverActions", { buffer = buffer, desc = "Hover Actions (Rust)" })
|
||||
vim.keymap.set("n", "<leader>cR", "RustCodeActionGroup", { buffer = buffer, desc = "Code Action (Rust)" })
|
||||
end
|
||||
end)
|
||||
local rust_opts = {
|
||||
server = vim.tbl_deep_extend("force", {}, opts, opts.server or {}),
|
||||
tools = { -- rust-tools options
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue