Skip to content

Add formatted JSON modes to the expanded reader#34

Merged
robince merged 6 commits into
mainfrom
codex/add-json-reader-formatting
Mar 25, 2026
Merged

Add formatted JSON modes to the expanded reader#34
robince merged 6 commits into
mainfrom
codex/add-json-reader-formatting

Conversation

@robince
Copy link
Copy Markdown
Owner

@robince robince commented Mar 25, 2026

Summary

  • add reader content modes so expanded cells can switch between raw text and pretty-printed JSON
  • default JSON-looking string values to a formatted, syntax-colored reader view with a mode badge and F toggle
  • preserve existing reader navigation while falling back to raw mode when a new row does not support JSON formatting

Testing

  • go test ./internal/ui
  • go test ./...

Copilot AI review requested due to automatic review settings March 25, 2026 16:02
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds multi-format rendering to the expanded cell reader, enabling automatic pretty-printed + syntax-colored JSON viewing (with a mode badge and F toggle) while preserving existing reader navigation and falling back to raw when formatting isn’t available.

Changes:

  • Introduces reader modes (raw, json pretty) with mode cycling (F) and automatic JSON-pretty defaulting for JSON-looking values.
  • Adds JSON pretty-printing + lightweight syntax highlighting, plus ANSI-aware wrapping/slicing for reader rendering.
  • Updates reader UI (header badge, footer/bottom-bar hints) and extends tests for mode selection, toggling, and fallback behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
internal/ui/styles.go Adds lipgloss styles for reader mode badges and JSON syntax token colors.
internal/ui/reader_render.go Implements reader mode logic, JSON pretty formatting, syntax highlighting, and ANSI-aware wrapping/slicing helpers.
internal/ui/model.go Stores reader mode state in the model, wires mode refresh/fallback on row changes, adds F handler, and updates reader rendering to use the new renderer.
internal/ui/model_test.go Adds/updates tests covering default JSON mode selection, invalid JSON behavior, F toggling, row-navigation fallback, and badge/rendered output checks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/ui/model.go Outdated
Comment thread internal/ui/reader_render.go Outdated
@robince
Copy link
Copy Markdown
Owner Author

robince commented Mar 25, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9a897a73b8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/ui/model.go Outdated
@robince robince merged commit b11811b into main Mar 25, 2026
3 checks passed
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.

2 participants