Skip to content

feat(viewer): show result type and length in the status line#120

Open
laurigates wants to merge 1 commit into
ynqa:mainfrom
laurigates:feat/result-summary
Open

feat(viewer): show result type and length in the status line#120
laurigates wants to merge 1 commit into
ynqa:mainfrom
laurigates:feat/result-summary

Conversation

@laurigates

Copy link
Copy Markdown

Summary

After each query, the status line now reports the type and length of the current result, so you don't have to append | type / | length to inspect a result's shape (#72).

Examples:

  • result: object · 3 keys
  • result: array · 5 items
  • result: string · 12 chars
  • result: number / boolean / null
  • result: stream · N values (multi-value output)
  • result: empty (0 results)

Implementation

  • A pure json::summarize(&[Value]) -> String helper mirrors jq's type/length semantics; it's unit tested (objects/arrays/strings, scalars, streams, empty, and Unicode char counting).
  • Surfaced through the existing guide/status mechanism (GuideMessage::ResultSummary) on the query-success path — no layout changes. Null and error results keep their existing messages.

Scope note

This shows the summary in the existing status line, which updates on each query result (the moment the shape matters). The issue mentions a vim-style persistent corner/bottom line; that would need a new dedicated render slot and layout rework. Happy to follow up with a persistent statusline if you'd prefer that direction — kept this change minimal and self-contained.

Closes #72

After each query the status line reports the current result's type and
length — e.g. `result: object · 3 keys`, `array · 5 items`,
`string · 12 chars`, or `stream · N values` — so users don't have to append
`| type` / `| length` to inspect the shape of a result (ynqa#72).

The summary is computed by a pure `json::summarize` helper (unit tested) and
surfaced through the existing guide/status mechanism, so it requires no
layout changes. It is shown on query success; null/error results keep their
existing messages.

Closes ynqa#72

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@laurigates

Copy link
Copy Markdown
Author

Related PRs (no strict merge order)#120, #121, and #122 are a small series of viewer / status-line improvements that independently edit the same code (refresh_view_with_query in src/json_viewer.rs, and src/guide.rs). They're independent in intent but overlap textually, so whichever merges first, the others will need a quick rebase — no specific order is required.

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.

Show length+type of current result set somewhere

1 participant