I'm writing a neovim plugin.
I want json decoding to fail silently. This is what I have tried:
partial_chunk = partial_chunk .. chunk
pcall(function()
-- vim.defer_fn(function()
local data = vim.fn.json_decode(partial_chunk .. "]")
on_next_line(data[#data].candidates[1].content.parts[1].text)
-- end, 0)
end)
do_some_stuff()
This gives me the error that I can't call a vimscript function in a fast event context.
I have tried wrapping the json_decode in vim.defer_fn but that doesn't work - i start seeing the errors.
I'm looking for a way to basically ignore whenever json_decode fails.