Skip to content

Instantly share code, notes, and snippets.

@h-michael
Created April 14, 2020 03:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save h-michael/f9c14288b79e76aa12740323f860acb8 to your computer and use it in GitHub Desktop.
Save h-michael/f9c14288b79e76aa12740323f860acb8 to your computer and use it in GitHub Desktop.
callbacks = vim.lsp.callbacks
callbacks['textDocument/publishDiagnostics'] = function(_, _, result)
if not result then return end
local uri = result.uri
local bufnr = vim.uri_to_bufnr(uri)
if not bufnr then
err_message("LSP.publishDiagnostics: Couldn't find buffer for ", uri)
return
end
util.buf_clear_diagnostics(bufnr)
util.buf_diagnostics_save_positions(bufnr, result.diagnostics)
util.buf_diagnostics_virtual_text(bufnr, result.diagnostics)
util.buf_diagnostics_signs(bufnr, result.diagnostics)
vim.api.nvim_command("doautocmd User LspDiagnosticsChanged")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment