Closed jknoetzke closed 2 years ago
I'm experiencing the same issue. May I ask why you closed it and, if applicable, how you resolved your issue? Thanks.
Ok, it seems using the following inside init.lua
file would be fine:
local rt = require("rust-tools")
rt.setup({
server = {
on_attach = function(_, bufnr)
-- Hover actions
vim.keymap.set("n", "<C-space>", rt.hover_actions.hover_actions, { buffer = bufnr })
-- Code action groups
vim.keymap.set("n", "<Leader>a", rt.code_action_group.code_action_group, { buffer = bufnr })
end,
},
})
But if you were following a blog like this one and do the following, you might get the error:
local rt = {
server = {
settings = {
on_attach = function(_, bufnr)
-- Hover actions
vim.keymap.set("n", "<C-space>", rt.hover_actions.hover_actions, { buffer = bufnr })
-- Code action groups
vim.keymap.set("n", "<Leader>a", rt.code_action_group.code_action_group, { buffer = bufnr })
require 'illuminate'.on_attach(client)
end,
["rust-analyzer"] = {
checkOnSave = {
command = "clippy"
},
},
}
},
}
require('rust-tools').setup(rt)
At least this is how I resolved the issue on my terminal.
What about the settings field? How do you configure ["rust-analyzer"]
? Or is it just the on_attach that needs to be moved up out of the settings field?
@Integralist Hey Mark, I ignored the settings field and do it like this:
local rt = require("rust-tools")
rt.setup({
server = {
on_attach = function(_, bufnr)
-- Hover actions
vim.keymap.set("n", "<C-space>", rt.hover_actions.hover_actions, { buffer = bufnr })
-- Code action groups
vim.keymap.set("n", "<Leader>a", rt.code_action_group.code_action_group, { buffer = bufnr })
end,
["rust-analyzer"] = {
checkOnSave = {
command = "clippy"
},
},
},
})
Checking the official README, it doesn't seem that settings
field is needed 🤔
@nahuakang ah nice! Thanks 🙂
Removing rust-tools plugin removes this error.. This was working fine for me in 0.7.x
Not sure if this is a nvim error or an error in this plugin. If it's in nvim, let me know and I'll open a issue with nvim