Skip to content

feat(format): support mapped VALUE suggester display text#1127

Merged
chhoumann merged 3 commits intomasterfrom
588-feature-request-support-text-item-and-item-in-suggester
Feb 27, 2026
Merged

feat(format): support mapped VALUE suggester display text#1127
chhoumann merged 3 commits intomasterfrom
588-feature-request-support-text-item-and-item-in-suggester

Conversation

@chhoumann
Copy link
Owner

@chhoumann chhoumann commented Feb 27, 2026

Support separate suggester display text and inserted values for VALUE option lists.

This adds |text: support to {{VALUE:...}} so users can show friendly labels in the suggester while storing/inserting a different mapped value.

What changed:

  • Extend VALUE parsing with |text: and strict validation:
    • only valid for option-list VALUE tokens
    • display and item counts must match
    • display entries must be unique
  • Runtime formatting now renders mapped display values while inserting mapped item values.
  • Preflight One Page Input flow now preserves the same mapping behavior:
    • dropdown shows display labels and stores mapped item values
    • suggester maps only completion selections; typed custom input remains typed
  • Add focused tests for parser/runtime/preflight mapping paths.
  • Document new syntax and current limitations in Format syntax docs.

This addresses the feature request to decouple display from inserted values in VALUE suggesters.

Fixes #588

Verification:

  • bun run test
  • bun run lint
  • bun run build
  • obsidian vault=dev plugin:reload id=quickadd
  • obsidian vault=dev eval ... edge-case pack (7/7 pass)

Open with Devin

Summary by CodeRabbit

  • New Features

    • VALUE text mapping: option lists can show custom labels while inserting different underlying values; dropdowns and autocomplete now display those labels and map selections back to stored values.
  • Bug Fixes / Validation

    • Added validation and errors for mismatched counts and duplicate display labels in VALUE mappings.
  • Documentation

    • Format syntax docs updated with the new VALUE text mapping variant and usage constraints.

@chhoumann chhoumann linked an issue Feb 27, 2026 that may be closed by this pull request
@vercel
Copy link

vercel bot commented Feb 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
quickadd Ready Ready Preview Feb 27, 2026 11:08pm

@coderabbitai
Copy link

coderabbitai bot commented Feb 27, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 54e07f0 and df0cb69.

📒 Files selected for processing (2)
  • src/utils/valueSyntax.test.ts
  • src/utils/valueSyntax.ts

📝 Walkthrough

Walkthrough

Adds VALUE token "text" mapping support (syntax {{VALUE:<items>|text:<display items>}}), propagating displayValues through parsing, requirement collection, formatter suggestion APIs, UI suggester/dropdown rendering, and value-mapping utilities; includes tests and docs updates.

Changes

Cohort / File(s) Summary
Documentation & Constants
docs/docs/FormatSyntax.md, src/constants.ts
Documented new VALUE text: variant and added VARIABLE_TEXT_SYNTAX into FORMAT_SYNTAX and FILE_NAME_FORMAT_SYNTAX.
Value Parsing & Tests
src/utils/valueSyntax.ts, src/utils/valueSyntax.test.ts
parseValueToken now recognizes text option, validates option-list-only usage, matching counts, and uniqueness; ParsedValueToken exposes displayValues; tests added for parsing and error cases.
Formatter API & Tests
src/formatters/formatter.ts, src/formatters/completeFormatter.ts, src/formatters/formatDisplayFormatter.ts, src/formatters/formatter-text-mapping.test.ts
Expanded suggestForValue context to include displayValues; concrete formatters prefer displayValues for suggestions while keeping fallbacks; new formatter tests exercise mapping behavior.
Requirement Collection & Tests
src/preflight/RequirementCollector.ts, src/preflight/RequirementCollector.test.ts
FieldRequirement gains displayOptions; RequirementCollector captures/propagates displayValues into requirements; tests validate option/display pairing and mismatch errors.
UI Mapping & Utilities
src/preflight/OnePageInputModal.ts, src/preflight/suggesterValueMapping.ts, src/preflight/suggesterValueMapping.test.ts
OnePageInputModal and suggester/dropdown render display labels and maintain display↔value maps; mapMappedSuggesterValue added to conditionally map completion inputs back to underlying values; tests cover mapping and custom-input scenarios.
New Tests (integration/coverage)
src/formatters/formatter-text-mapping.test.ts, src/preflight/suggesterValueMapping.test.ts
New test suites validate end-to-end and utility-level behaviors for display/value mappings and edge cases.

Sequence Diagram

sequenceDiagram
    participant User
    participant UI
    participant Formatter
    participant Parser
    participant Suggester

    User->>UI: focus / request suggestions
    UI->>Formatter: request suggestions (context)
    Formatter->>Parser: parse VALUE token
    Parser-->>Formatter: ParsedValueToken (suggestedValues, displayValues)
    Formatter->>Suggester: supply displayValues as labels (suggestedValues as fallback)
    Suggester-->>UI: show display labels to user
    User->>UI: select display label (or type custom)
    UI->>UI: map display -> actual value (via displayToValue) if selection from completion
    UI-->>User: insert actual value into capture
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Poem

🐰 A rabbit hops with cheer,
Two lists—what you see, what goes near.
Pick "Normal" on the list, insert 🔼 in the file,
Mapped labels and values dance for a while,
Hoppy captures—done with a smile! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(format): support mapped VALUE suggester display text' accurately and concisely summarizes the main feature addition: enabling separate display text from inserted values in VALUE tokens.
Linked Issues check ✅ Passed The PR implementation fully addresses issue #588 by introducing the |text: syntax to map display values to inserted values in VALUE tokens, with comprehensive validation and runtime support.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the mapped VALUE display text feature requested in #588; no unrelated modifications were introduced.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 588-feature-request-support-text-item-and-item-in-suggester

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 27, 2026

Deploying quickadd with  Cloudflare Pages  Cloudflare Pages

Latest commit: df0cb69
Status:⚡️  Build in progress...

View logs

coderabbitai[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 5 additional findings.

Open in Devin Review

@chhoumann chhoumann merged commit b8ec56c into master Feb 27, 2026
3 of 5 checks passed
@chhoumann chhoumann deleted the 588-feature-request-support-text-item-and-item-in-suggester branch February 27, 2026 23:10
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 REQUEST] Support "text item" and "item" in suggester

1 participant