Closed kqvanity closed 6 days ago
I currently use the picker to display accompanying metadata/info that may/may not rely on the presence of items in the picker. Telescope's current behavior wouldn't display any data available at the previewer if the picker is devoid of items. I was wondering if there's a workaround
I'm not aware of any great ways to do this. Maybe just always having a dummy entry for the metadata. But as the name suggests, the previewer is a thing for previewing results. It's not really designed at a blank window to rendering whatever information.
Sometimes I'd like to directly access the bufnr of the preview window right from the picker. My current workaround is declaring a top-level variable that gets updated at define_preview via self.state.bufnr then access from the picker, but I'm wondering if there's a direct way to access it!
You should be able to get the previewer bufnr from the picker, picker.preview_bufnr
.
Can the preview render regular text as markdown?
Theoretically yes, but you'll have to do a lot your own leg work for the define_preview
of new_buffer_previewer
. You won't be able to leverage buffer_preview_maker
since that either handles filetype detection or you can use the filetype_hook
but that's mostly for blocking previewing certain filetypes.
setup function of previewers.new_buffer_previewer is stated -according to the docs- to return a table which should be access at self.state of define_preview but that's not the case. Only bufnr and win_id are available. I define an initial one-off value during preview initialization and would like to create it once & continually access later on at each define_preview invocation. My current workaround is a local variable at previewers.new_buffer_previewer wrapper function, which works but because I use define_preview to define initial state, the state keeps getting reset when scrolling up/down.
No you're right, that appears to be a bug. I will fix that immediately thanks.
No you're right, that appears to be a bug. I will fix that immediately thanks.
Thanks
You should be able to get the previewer bufnr from the picker, picker.preview_bufnr.
can you please provide more context. I'm trying to access the preview bufnr from within attach_mappings
callback
Is your feature request related to a problem? Please describe. I'm trying to develop a telescope extension. During development I faced couple of issues
bufnr
of the preview window right from the picker. My current workaround is declaring a top-level variable that gets updated atdefine_preview
viaself.state.bufnr
then access from the picker, but I'm wondering if there's a direct way to access it!Can the preview render regular text as markdown?
setup function of
previewers.new_buffer_previewer
is stated -according to the docs- to return a table which should be access atself.state
ofdefine_preview
but that's not the case. Onlybufnr
andwin_id
are available. I define an initial one-off value during preview initialization and would like to create it once & continually access later on at eachdefine_preview
invocation. My current workaround is a local variable atpreviewers.new_buffer_previewer
wrapper function, which works but because I usedefine_preview
to define initial state, the state keeps getting reset when scrolling up/down.Current finder implementation
Additional context I'm using Telescope from master branch on Arch Linux.
Checkhealth output