♻️ refactor(nvim): change rust-tools for rustaceanvim

This commit is contained in:
Sergio Laín 2024-01-03 11:08:50 +01:00
parent 469cb8e820
commit 849f08267e
No known key found for this signature in database
GPG key ID: 14C9B8080681777B
2 changed files with 63 additions and 1 deletions

View file

@ -106,7 +106,7 @@
"presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" },
"rainbow-delimiters.nvim": { "branch": "master", "commit": "4a90ac83c7c8e0ba8a1b6af38bed6d5ee1b04e08" },
"refactoring.nvim": { "branch": "master", "commit": "156532476deb10b1b2a32cb38e1078b3f9951c42" },
"rust-tools.nvim": { "branch": "master", "commit": "676187908a1ce35ffcd727c654ed68d851299d3e" },
"rustaceanvim": { "branch": "master", "commit": "3a439b5c76f0e54bd8bf3b498a849079015fc20f" },
"satellite.nvim": { "branch": "main", "commit": "1a20861227eba8bf2d8282ab4ec5fc071e8b20e2" },
"search-replace.nvim": { "branch": "main", "commit": "d92290a02d97f4e9b8cd60d28b56b403432158d5" },
"semshi": { "branch": "master", "commit": "0182447e2ff4dfa04cd2dfe5f189e012c581ca45" },

View file

@ -1,5 +1,67 @@
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,