Switch from rust-tools (the repository was archived) to rustaceanvim

Set Cargo to run Clippy
This commit is contained in:
Knyffen 2024-01-19 21:16:07 +01:00
parent ded7f54b60
commit 7727b2a8fa

View File

@ -89,7 +89,8 @@
" Language server " Language server
Plug 'neovim/nvim-lspconfig' Plug 'neovim/nvim-lspconfig'
Plug 'simrat39/rust-tools.nvim' Plug 'mrcjkb/rustaceanvim', { 'tag': '3.*' }
Plug 'lvimuser/lsp-inlayhints.nvim' " TODO: Inlay hints. Will be native to nvim in v0.10, so delete after that
" Support for DAP (Debug Adapter Protocol) " Support for DAP (Debug Adapter Protocol)
Plug 'mfussenegger/nvim-dap' Plug 'mfussenegger/nvim-dap'
@ -1383,21 +1384,32 @@ endif
" Requires rust-analyzer to be installed on the system " Requires rust-analyzer to be installed on the system
let g:rustfmt_on_save = 1 " vim-rustfmt let g:rustfmt_on_save = 1 " vim-rustfmt
lua <<EOF lua <<EOF
local rt = require 'rust-tools' require("lsp-inlayhints").setup()
rt.setup({ vim.g.rustaceanvim = {
-- LSP configuration
server = { server = {
on_attach = function(_, bufnr) on_attach = function(client, bufnr)
-- vim.keymap.set("n", "<Leader>ll", ':w <CR> :!cargo run <CR>', { buffer = bufnr }) -- vim.keymap.set("n", "<Leader>ll", ':w <CR> :!cargo run <CR>', { buffer = bufnr })
vim.keymap.set("n", "<Leader>ll", ":w <CR> :!cargo run 3>&2 2>&1 1>&3 | grep -o 'could not find `Cargo.toml`' > /dev/null && (rustc %:p && %:p:r)<CR>", { buffer = bufnr }) vim.keymap.set("n", "<Leader>ll", ":w <CR> :!cargo run 3>&2 2>&1 1>&3 | grep -o 'could not find `Cargo.toml`' > /dev/null && (rustc %:p && %:p:r)<CR>", { buffer = bufnr })
require("lsp-inlayhints").on_attach(client, bufnr)
require("lsp-inlayhints").show()
end, end,
}, settings = {
tools = { -- rust-analyzer language server configuration
inlay_hints = { ['rust-analyzer'] = {
auto = true, -- enable inlay_hints check = {
command = 'clippy',
},
},
}, },
}, },
}) -- Plugin configuration
tools = {
},
-- DAP configuration
dap = {
},
}
EOF EOF
" }}} " }}}