Skip to content

feat(session-picker): add full message preview with formatter rendering#398

Merged
sudo-tee merged 4 commits into
sudo-tee:mainfrom
jensenojs:feat/session-picker-preview-v2
Jun 4, 2026
Merged

feat(session-picker): add full message preview with formatter rendering#398
sudo-tee merged 4 commits into
sudo-tee:mainfrom
jensenojs:feat/session-picker-preview-v2

Conversation

@jensenojs
Copy link
Copy Markdown
Contributor

@jensenojs jensenojs commented Jun 1, 2026

base on #393, to close #391

just for try out, @sudo-tee

@jensenojs jensenojs force-pushed the feat/session-picker-preview-v2 branch from cbbb455 to 67c3130 Compare June 3, 2026 06:05
@sudo-tee
Copy link
Copy Markdown
Owner

sudo-tee commented Jun 4, 2026

@jensenojs

After testing this, I really like this.

A little nitpick is the line numbers, in the preview

361ef0d6e79eb8a569285b7a3477e85cf2035ceee6613d132169df5ba4518867

It would look better without them

d98345eca9ab09f6c938b1f376146ac69d7d8e377f37b7068a9be7c200db89d5

A part from that once the conflict is resolved and the code is rebased, it should be good to go.

jensenojs added 3 commits June 4, 2026 19:51
- base_picker: add preview='custom' + preview_fn type, Telescope
  buffer_previewer implementation for custom content preview
- output_window: extract apply_extmarks(bufnr, extmarks, line_offset?)
  as reusable public function; set_extmarks delegates to it
- api_client: list_messages(id, directory, opts?) accepts opts table
  for query parameters (e.g. limit)
- session: get_messages(session, opts?) passes opts through
Session picker now shows a rich preview when selecting a session:
- normalize_message_order: handle API descending order
- filter_preview_messages: show first user msg + last assistant reply
- format_messages: reuse existing formatter for consistent rendering
  (pcall per-part, no get_child_parts, no previous_message)
- render_preview_buffer: direct nvim API with window-local folds
- preview_fn: synchronous load via Promise:wait() (~20-30ms)

Only Telescope backend supported in this commit.
- Unify custom preview rendering behind a backend-neutral preview target so
  session previews work consistently with Telescope, fzf-lua, and Snacks.

- Normalize picker plugin aliases such as fzf-lua, telescope.nvim, and
  snacks.nvim to their internal backend names, and add regression coverage for
  custom preview behavior across the picker integrations.
@jensenojs jensenojs force-pushed the feat/session-picker-preview-v2 branch from 67c3130 to 5634272 Compare June 4, 2026 11:52
@jensenojs
Copy link
Copy Markdown
Contributor Author

jensenojs commented Jun 4, 2026

@jensenojs

After testing this, I really like this.

A little nitpick is the line numbers, in the preview
361ef0d6e79eb8a569285b7a3477e85cf2035ceee6613d132169df5ba4518867

It would look better without them
d98345eca9ab09f6c938b1f376146ac69d7d8e377f37b7068a9be7c200db89d5

A part from that once the conflict is resolved and the code is rebased, it should be good to go.

plz try again, I'm a bit too lazy to reproduce this locally. For some reason, my telescope doesn't have this issue, but if it did, I'd definitely fix it.

@jensenojs
Copy link
Copy Markdown
Contributor Author

I still have some minor improvements and optimizations I want to make, but I need to take a break. Not sure when I'll tinker with this plugin next, maybe soon.

@sudo-tee
Copy link
Copy Markdown
Owner

sudo-tee commented Jun 4, 2026

Thank you very much it works really great now :).

I think we can merge this and, if there is any other optimization to be done we can add them later.

@jensenojs
Copy link
Copy Markdown
Contributor Author

Just shove it somewhere, I don't want this issue to be closed, lol

anomalyco/opencode#17322

@sudo-tee sudo-tee merged commit c6c8c78 into sudo-tee:main Jun 4, 2026
5 checks passed
@jensenojs jensenojs deleted the feat/session-picker-preview-v2 branch June 4, 2026 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature] : preview for session message

2 participants