Merge pull request #170 from Pocco81/dev-lsp

Lang servers error suppression and better "publish diagnostics" glyph
This commit is contained in:
siduck76 2021-07-21 22:48:44 +05:30 committed by GitHub
commit c1544dd020
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 26 additions and 0 deletions

View File

@ -94,3 +94,29 @@ vim.fn.sign_define("LspDiagnosticsSignError", {text = "", numhl = "LspDiagnos
vim.fn.sign_define("LspDiagnosticsSignWarning", {text = "", numhl = "LspDiagnosticsDefaultWarning"})
vim.fn.sign_define("LspDiagnosticsSignInformation", {text = "", numhl = "LspDiagnosticsDefaultInformation"})
vim.fn.sign_define("LspDiagnosticsSignHint", {text = "", numhl = "LspDiagnosticsDefaultHint"})
vim.lsp.handlers["textDocument/publishDiagnostics"] =
vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics,
{
virtual_text = {
-- prefix = "",
prefix = "",
spacing = 0
},
signs = true,
underline = true
}
)
-- suppress error messages from lang servers
vim.notify = function(msg, log_level, _opts)
if msg:match("exit code") then
return
end
if log_level == vim.log.levels.ERROR then
vim.api.nvim_err_writeln(msg)
else
vim.api.nvim_echo({{msg}}, true, {})
end
end