Fix broken rust_analyzer diagnostics

main
Nick Zana 6 days ago
parent 51df129f13
commit c7a56d9884

@ -4,6 +4,14 @@ return {
config = function()
-- Reserve a space in the gutter
vim.opt.signcolumn = 'yes'
-- Configure diagnostics for 0.11
vim.diagnostic.config({
virtual_text = true,
signs = true,
underline = true,
update_in_insert = false,
})
vim.api.nvim_create_autocmd('LspAttach', {
desc = 'LSP actions',
callback = function(event)
@ -40,11 +48,13 @@ return {
})
vim.lsp.config('rust_analyzer', {
cmd = { 'rust-analyzer' },
settings = {
["rust-analyzer"] = {
checkOnSave = {
allFeatures = true,
command = { "clippy" },
checkOnSave = true,
check = {
features = "all",
overrideCommand = { "clippy" },
},
procMacro = {
enable = true,
@ -83,16 +93,6 @@ return {
vim.lsp.enable('ts_ls')
vim.lsp.enable('oxlint')
-- Workaround for rust_analyzer diagnostic issue
for _, method in ipairs({ 'textDocument/diagnostic', 'workspace/diagnostic' }) do
local default_diagnostic_handler = vim.lsp.handlers[method]
vim.lsp.handlers[method] = function(err, result, context, config)
if err ~= nil and err.code == -32802 then
return
end
return default_diagnostic_handler(err, result, context, config)
end
end
end,
}
}

Loading…
Cancel
Save