1
0
Fork 1
Dotfiles_nvim/lua/toolchain/rust.lua

53 lines
1.5 KiB
Lua
Raw Normal View History

2024-11-23 16:55:23 +00:00
local T = require('toolchain')
local M = {}
function M.setup()
T.add_highlighter_autoinstalls('rust')
T.add_null_ls_module(
function(null_ls)
return {
{
name = 'clippy',
method = null_ls.methods.FORMATTING,
filetypes = { 'rust' },
generator = require('null-ls.helpers').formatter_factory({
command = 'rustfmt',
to_stdin = true,
input = '$TEXT',
}),
},
}
end
)
T.add_lsp_autoinstalls('rust_analyzer')
T.add_lsps(
function(lspconfig, capabilities)
lspconfig.rust_analyzer.setup({
cmd = { 'ra-multiplex' },
settings = {
['rust-analyzer'] = {
check = {
overrideCommand = {
'cargo',
'clippy',
'--message-format=json-diagnostic-rendered-ansi',
'--fix',
'--allow-dirty',
},
},
},
},
})
end
)
end
--[[T.add_plugins({
'mrcjkb/rustaceanvim',
version = '^5', -- Recommended
lazy = false, -- This plugin is already lazy
})]]
--
return M