Open miszo opened 1 week ago
I've added the echo statement in the create_image
function
local create_image = function(filepath, winid, bufnr)
image = image_api.from_file(filepath, { window = winid, buffer = bufnr })
if not image then
return
end
image:render()
vim.api.nvim_echo({
{ 'image.is_rendered: ' .. tostring(image.is_rendered), nil },
}, false, {})
is_image_preview = true
end
And on the first try it prints image.is_rendered: false
But on the second try it returns the image.is_rendered: true
I'm not sure whether it should be the actual solution, but I've wrapped it with the vim.defer_fn
and it works every time 😅
local create_image = function(filepath, winid, bufnr)
image = image_api.from_file(filepath, { window = winid, buffer = bufnr })
if not image then
return
end
vim.defer_fn(function()
image:render()
end, 0)
is_image_preview = true
end
@miszo I'd love to play around with this telescope previewer. Do you have a repo to install this as a telescope extension?
@exosyphon, didn't go that deep to set up this as a telescope extension.
Here's the code for:
I'm trying to use your plugin to render previews in telescope. I've created a bufferpreviewer_maker like this:
And I have the problem when I try to preview the image for the first time – it doesn't render, it renders on the second attempt.
I think that the problem is in the create_image function.
Any ideas how to resolve the issue?
My env:
Plugin setup: