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
clangd_client.request('textDocument/switchSourceHeader', params, function(err, result)
if err then
print 'Error dane'
error(tostring(err))
vim.schedule(function()
vim.notify('Clangd: switchSourceHeader gave error: ' .. tostring(err), vim.log.levels.ERROR)
end)
end
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
end
vim.cmd.edit(vim.uri_to_fname(result))
end, 0)
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