1
0
Fork 1
Dotfiles_nvim/lua/toolchain/rust.lua
2024-11-23 17:55:23 +01:00

52 lines
1.5 KiB
Lua

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