I had copied the Rust code from this repo & was debugging some issue when I realised that the LSP isn't being configured correctly.
This is the problematic part of the code (https://github.com/appelgriebsch/Nv/blob/main/lua/plugins/extras/lang/rust.lua#L62-L91):
local rust_tools_opts = vim.tbl_deep_extend("force", opts, {
tools = {
hover_actions = {
auto_focus = false,
border = "none",
},
inlay_hints = {
auto = false,
show_parameter_hints = true,
},
},
server = {
settings = {
["rust-analyzer"] = {
cargo = {
features = "all",
},
-- Add clippy lints for Rust.
checkOnSave = true,
check = {
command = "clippy",
features = "all",
},
procMacro = {
enable = true,
},
}
}
}
})
This is how it should be:
local rust_tools_opts = {
tools = {
hover_actions = {
auto_focus = false,
border = "none",
},
inlay_hints = {
auto = false,
show_parameter_hints = true,
},
},
server = vim.tbl_deep_extend("force", opts, {
settings = {
["rust-analyzer"] = {
cargo = {
features = "all",
},
-- Add clippy lints for Rust.
checkOnSave = true,
check = {
command = "clippy",
features = "all",
},
procMacro = {
enable = true,
},
}
}
})
}