Skip to content

feat: configure focused Cirru previews - #41

Merged
tiye merged 2 commits into
mainfrom
codex/focus-preview-options
Aug 1, 2026
Merged

feat: configure focused Cirru previews#41
tiye merged 2 commits into
mainfrom
codex/focus-preview-options

Conversation

@tiye

@tiye tiye commented Jul 28, 2026

Copy link
Copy Markdown
Member

Adds a backward-compatible CirruFocusOptions API for custom focus/fold markers, root-prefix preservation, and target/non-target folding limits. Keeps focus_cirru_preview defaults unchanged. Includes unit tests, doctests, README docs, and an executable example. Local cargo test, serde-json tests, and clippy all pass.

Copilot AI review requested due to automatic review settings July 28, 2026 10:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a backward-compatible, configurable API for generating focused/folded Cirru “preview” trees, allowing callers to customize markers, preserve a root signature prefix, and tune fold limits while keeping focus_cirru_preview defaults unchanged.

Changes:

  • Introduces CirruFocusOptions and focus_cirru_preview_with_options for configurable focused previews, while preserving existing focus_cirru_preview behavior.
  • Updates crate exports to expose the new API from the crate root.
  • Adds documentation and examples (README + runnable example) and extends unit tests for the new options.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/parser_test.rs Minor cleanup to use map(Cirru::List) in serde-json parser test.
src/parser.rs Re-exports CirruFocusOptions and focus_cirru_preview_with_options from the crate root.
src/focus.rs Implements configurable focus/fold options, root-prefix preservation, and adds tests/doctests.
README.md Documents the focused preview API and how to customize it.
examples/focus_cirru_preview.rs Demonstrates both default focusing and customized focusing via options.
Comments suppressed due to low confidence (1)

src/focus.rs:80

  • The doc comment for folded_place still hard-codes 'FOLDED:... and claims the placeholder leaf will always print bare. Now that options.folded_marker is user-configurable, the placeholder may not be 'FOLDED:..., and if the marker (or detail) contains spaces/non-ASCII it will be quoted/escaped by the writer (see README escaping example). Updating this comment will prevent misleading API docs.
/// Build a `'FOLDED:...` placeholder: a single bare Cirru symbol leaf.
///
/// Uses the `'` symbol prefix (not `|` string prefix): this is an
/// identifier-like marker, not free-form string data, so `'FOLDED:...`
/// matches Cirru's own convention for such tokens. Deliberately a single

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

@tiye
tiye requested a review from a team July 29, 2026 18:26
@tiye
tiye merged commit eab40ca into main Aug 1, 2026
2 checks passed
@tiye
tiye deleted the codex/focus-preview-options branch August 1, 2026 08:52
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