fix(picker.preview): preview for uris. Closes #1075

This commit is contained in:
Folke Lemaitre 2025-02-11 13:49:36 +01:00
parent 7cbecf9147
commit c1f93e25bb
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -79,6 +79,9 @@ function M.file(ctx)
-- used by some LSP servers that load buffers with custom URIs
if ctx.item.buf and vim.uri_from_bufnr(ctx.item.buf):sub(1, 4) ~= "file" then
vim.fn.bufload(ctx.item.buf)
elseif ctx.item.file and ctx.item.file:find("^%w+://") then
ctx.item.buf = vim.fn.bufadd(ctx.item.file)
vim.fn.bufload(ctx.item.buf)
end
if ctx.item.buf and vim.api.nvim_buf_is_loaded(ctx.item.buf) then