dotfiles/.config/nvim/lua/plugins/extras/lang/rust-extended.lua
2024-01-03 11:08:50 +01:00

72 lines
1.8 KiB
Lua

return {
{ import = "lazyvim.plugins.extras.lang.rust" },
{
"simrat39/rust-tools.nvim",
enabled = false,
},
{
"mrcjkb/rustaceanvim",
version = "^3", -- Recommended
ft = { "rust" },
opts = {
server = {
on_attach = function(client, bufnr)
-- register which-key mappings
local wk = require("which-key")
-- stylua: ignore
wk.register({
["<leader>cR"] = { function() vim.cmd.RustLsp("codeAction") end, "Code Action" },
["<leader>dr"] = { function() vim.cmd.RustLsp("debuggables") end, "Rust debuggables" },
}, { mode = "n", buffer = bufnr })
end,
settings = {
-- rust-analyzer language server configuration
["rust-analyzer"] = {
cargo = {
allFeatures = true,
loadOutDirsFromCheck = true,
runBuildScripts = true,
},
-- Add clippy lints for Rust.
checkOnSave = {
allFeatures = true,
command = "clippy",
extraArgs = { "--no-deps" },
},
procMacro = {
enable = true,
ignored = {
["async-trait"] = { "async_trait" },
["napi-derive"] = { "napi" },
["async-recursion"] = { "async_recursion" },
},
},
},
},
},
},
config = function(_, opts)
vim.g.rustaceanvim = vim.tbl_deep_extend("force", {}, opts or {})
end,
},
{
"neovim/nvim-lspconfig",
opts = {
servers = {
rust_analyzer = {},
},
setup = {
rust_analyzer = function()
return true
end,
},
},
},
{
"luckasRanarison/nvim-devdocs",
optional = true,
ensure_installed = {
"rust",
},
},
}