lazyvim/lua/plugins/rust-tools.lua

41 lines
1022 B
Lua
Raw Normal View History

2023-02-05 00:36:44 +01:00
return {
"simrat39/rust-tools.nvim",
config = function()
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,
2023-02-05 20:31:25 +01:00
settings = {
["rust-analyzer"] = {
2023-02-05 20:31:25 +01:00
imports = {
granularity = {
group = "module",
},
prefix = "self",
},
cargo = {
2023-03-16 08:01:27 +01:00
allFeatures = true,
2023-02-05 20:31:25 +01:00
buildScripts = {
enable = true,
},
2023-03-16 08:01:27 +01:00
procMacro = {
enable = true,
}
2023-02-05 20:31:25 +01:00
},
2023-03-16 08:01:27 +01:00
checkOnSave = {
allFeatures = true,
enable = true
}
2023-02-05 20:31:25 +01:00
},
},
2023-02-05 00:36:44 +01:00
},
})
end,
}