Add formatted JSON modes to the expanded reader#34
Conversation
There was a problem hiding this comment.
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.
|
@codex review |
There was a problem hiding this comment.
💡 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".
Summary
FtoggleTesting
go test ./internal/uigo test ./...