nvim: lsp: Use vim.notify to report error

This commit is contained in:
Sanchayan Maity 2022-10-02 11:48:03 +05:30
parent cb12ad28ab
commit 6d7a9fe9b3

View file

@ -98,19 +98,24 @@ local switch_source_header = function()
if clangd_client then if clangd_client then
clangd_client.request('textDocument/switchSourceHeader', params, function(err, result) clangd_client.request('textDocument/switchSourceHeader', params, function(err, result)
if err then if err then
print 'Error dane' vim.schedule(function()
error(tostring(err)) vim.notify('Clangd: switchSourceHeader gave error: ' .. tostring(err), vim.log.levels.ERROR)
end)
end end
if not result then if not result then
print 'Corresponding file cannot be determined' vim.schedule(function()
vim.notify('Clangd: switchSourceHeader, corresponding file not determined', vim.log.levels.ERROR)
end)
return return
end end
vim.cmd.edit(vim.uri_to_fname(result)) vim.cmd.edit(vim.uri_to_fname(result))
end, 0) end, 0)
else else
print 'Method switchSourceHeader is not supported by server active on the current buffer' vim.schedule(function()
vim.notify('Clangd: switchSourceHeader is not supported', vim.log.levels.ERROR)
end)
end end
end end