fix(rust-analyzer): filter out hint diagnostics

This commit is contained in:
2025-10-02 05:51:39 +02:00
parent c45385a92e
commit eb5b557f97
+20 -1
View File
@@ -450,7 +450,26 @@ function M.setup()
})
vim.lsp.config("rust_analyzer", {
on_attach = M.with_defaults("rust_analyzer"),
on_attach = M.with_defaults("rust_analyzer", function(client)
local handler_name = "textDocument/publishDiagnostics"
local default_handler = client.handlers[handler_name]
or vim.lsp.handlers[handler_name]
client.handlers[handler_name] = function(
err,
result,
context,
config
)
if result and result.diagnostics then
result.diagnostics = vim.tbl_filter(function(diagnostic)
return diagnostic.severity
< vim.diagnostic.severity.HINT
end, result.diagnostics)
end
default_handler(err, result, context, config)
end
end),
settings = {
["rust-analyzer"] = {
inlayHints = {