refactor(nvim): improve lsp log format
Some checks failed
Check Formatting of Files / Check-Formatting (push) Failing after 47s

This commit is contained in:
Price Hiller 2024-12-13 22:40:34 -06:00
parent a06491ea40
commit c540d91464
Signed by: Price
GPG Key ID: C3FADDE7A8534BEB

View File

@ -1,17 +1,8 @@
local M = {}
M.setup = function()
-- HACK: See https://github.com/neovim/neovim/issues/30985#issuecomment-2447329525
-- This fixes an issue with "server cancelled the request" emissions from `rust-analyzer`
for _, method in ipairs({ "textDocument/diagnostic", "workspace/diagnostic" }) do
local default_diagnostic_handler = vim.lsp.handlers[method]
vim.lsp.handlers[method] = function(error, result, ctx, config)
if error ~= nil and error.code == -32802 then
return
end
return default_diagnostic_handler(error, result, ctx, config)
end
end
vim.lsp.set_log_level(vim.log.levels.DEBUG)
vim.lsp.log.set_format_func(vim.inspect)
vim.diagnostic.config({
severity_sort = true,
underline = true,