Switch from rust-tools (the repository was archived) to rustaceanvim
Set Cargo to run Clippy
This commit is contained in:
parent
ded7f54b60
commit
7727b2a8fa
32
init.vim
32
init.vim
@ -89,7 +89,8 @@
|
||||
|
||||
" Language server
|
||||
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)
|
||||
Plug 'mfussenegger/nvim-dap'
|
||||
@ -1383,21 +1384,32 @@ endif
|
||||
" Requires rust-analyzer to be installed on the system
|
||||
let g:rustfmt_on_save = 1 " vim-rustfmt
|
||||
lua <<EOF
|
||||
local rt = require 'rust-tools'
|
||||
rt.setup({
|
||||
require("lsp-inlayhints").setup()
|
||||
vim.g.rustaceanvim = {
|
||||
-- LSP configuration
|
||||
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 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,
|
||||
},
|
||||
tools = {
|
||||
inlay_hints = {
|
||||
auto = true, -- enable inlay_hints
|
||||
settings = {
|
||||
-- rust-analyzer language server configuration
|
||||
['rust-analyzer'] = {
|
||||
check = {
|
||||
command = 'clippy',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
-- Plugin configuration
|
||||
tools = {
|
||||
},
|
||||
-- DAP configuration
|
||||
dap = {
|
||||
},
|
||||
}
|
||||
EOF
|
||||
" }}}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user