BUGFIX: Fix Error Notifications

These errors need to be wrapped in a delay call in order to actually
work, otherwise we run into this error: https://www.reddit.com/r/neovim/comments/qz4wy6/how_can_i_do_this/
This commit is contained in:
Harrison Cramer
2023-08-03 10:22:49 -04:00
parent 74afe95d0e
commit 2f60984c90

View File

@@ -19,15 +19,20 @@ M.run_job = function(endpoint, method, body, callback)
if callback ~= nil then if callback ~= nil then
callback(data) callback(data)
else else
vim.defer_fn(function()
vim.notify(data.message, vim.log.levels.DEBUG) vim.notify(data.message, vim.log.levels.DEBUG)
end, 0)
end end
else else
vim.defer_fn(function()
vim.notify("Could not parse command output!", vim.log.levels.ERROR) vim.notify("Could not parse command output!", vim.log.levels.ERROR)
end, 0)
end end
end, end,
on_stderr = function(_, output) on_stderr = function(_, output)
vim.defer_fn(function()
vim.notify("Could not run command!", vim.log.levels.ERROR) vim.notify("Could not run command!", vim.log.levels.ERROR)
error(output) end, 0)
end end
}):start() }):start()
end end