Skip to content

feat(format): mimic option-list spacing in format:inline - #1716

Open
chhoumann wants to merge 1 commit into
masterfrom
cursor/inline-format-whitespace-6fe2
Open

feat(format): mimic option-list spacing in format:inline#1716
chhoumann wants to merge 1 commit into
masterfrom
cursor/inline-format-whitespace-6fe2

Conversation

@chhoumann

@chhoumann chhoumann commented Aug 30, 2026

Copy link
Copy Markdown
Owner

Summary

{{VALUE:option a, option b|multi|format:inline}} now inserts option a, option b. A compact list still inserts option a,option b. That is the spacing the author already wrote in the option list. There is no new |separator: flag.

Fixes #1701

Changes

  • ResolvedMultiValueFormat carries an InlineSeparator only on the inline arm. MultiValueFormat stays the |format: keyword.
  • parseValueToken infers "," vs ", " from delimiter commas in the VALUE option list. Quoted commas are not delimiters. Mixed spacing stays compact.
  • FIELD and FILE call resolveMultiValueFormat(keyword) with no evidence, so their inline output stays Alpha,Beta.
  • splitQuotedCommaList stays exported. It is a projection of a private scan.
  • Docs in FormatSyntax.md describe the VALUE mimic rule.

Tradeoffs

Unanimous-or-compact mixed lists. a, b,c stays a,b. A stray missing space does not flip the whole list. Existing VALUE templates that already wrote , in the option list and used |format:inline will start emitting spaces. That is the requested behavior.

auto, yaml, and markdown are unchanged, including the rawValue.join(",") body-text fallback.

Blast Radius

Template authors who use |format:inline on VALUE option lists. FIELD/FILE inline, auto, yaml, and markdown readers see no change. The resolved union replaces the string multiFormat on parsed VALUE/FILE tokens. In-repo tests were updated. Out-of-tree imports of MultiValueFormat as a string still compile. ParsedValueToken.multiFormat is now an object.

Testing / validation

  • pnpm exec vitest run on the formatter/parser files: 8 files, 313 tests passed.
  • pnpm run test: 412 files, 5100 tests passed (37 skipped).
  • pnpm run build-with-lint: tsc, eslint, and production bundle succeeded.

Checklist

  • PR title follows Conventional Commits
  • Linked any related issue(s).
  • Noted release/migration impact, if any. Existing VALUE |format:inline tokens with spaces after commas in the option list will emit those spaces. Compact lists and FIELD/FILE are unchanged.
Open in Web Open in Cursor 

Summary by CodeRabbit

  • New Features

    • Inline multi-select values now preserve the spacing used in their option list, such as a,b or a, b.
    • Automatic format handling is now consistently resolved across value and file tokens.
  • Bug Fixes

    • Corrected inline rendering for spaced multi-select options.
  • Documentation

    • Updated format syntax documentation to describe comma-spacing behavior for different token types.

VALUE |format:inline joins picks with ", " when every option-list comma
is followed by horizontal whitespace. Mixed lists, compact lists, and
FIELD/FILE inline stay ",".

Fixes #1701

Co-authored-by: Christian Bager Bach Houmann <christian@bagerbach.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 30, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-30T17:02:51.483385Z 0a16429 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b1d949dc-c185-4b7e-b79c-7f3d287420c0

📥 Commits

Reviewing files that changed from the base of the PR and between 607f451 and 0a16429.

📒 Files selected for processing (11)
  • docs/src/content/docs/docs/FormatSyntax.md
  • src/formatters/completeFormatter.test.ts
  • src/formatters/formatter.ts
  • src/utils/FieldSuggestionParser.test.ts
  • src/utils/FieldSuggestionParser.ts
  • src/utils/fileSyntax.test.ts
  • src/utils/fileSyntax.ts
  • src/utils/multiValueFormat.test.ts
  • src/utils/multiValueFormat.ts
  • src/utils/valueSyntax.test.ts
  • src/utils/valueSyntax.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

format:inline now preserves comma spacing from VALUE option lists. Multi-value formats use structured descriptors with explicit separators. Field and file parsers, formatter consumers, tests, and documentation now use the resolved representation.

Changes

Inline multi-select spacing

Layer / File(s) Summary
Resolved format contract and rendering
src/utils/multiValueFormat.ts, src/utils/multiValueFormat.test.ts, src/formatters/formatter.ts
Formats now resolve to objects. Inline rendering joins values with either , or , . Other formats retain their existing output.
Option-list spacing inference
src/utils/valueSyntax.ts, src/utils/valueSyntax.test.ts
VALUE parsing tracks comma spacing, including quoted items and mappings, then resolves the inline separator from the option list.
Parser consumers and validation
src/utils/FieldSuggestionParser.ts, src/utils/fileSyntax.ts, src/formatters/completeFormatter.test.ts, docs/src/content/docs/docs/FormatSyntax.md
Field and file tokens expose resolved formats. Formatter routing tests cover spaced inline output. Documentation describes VALUE, FIELD, and FILE behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 0a164

This change only preserves authored comma spacing for inline VALUE option lists while leaving other formatting paths unchanged. No actionable merge-blocking risk remains after normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant VALUEToken
  participant parseValueToken
  participant scanQuotedCommaList
  participant resolveMultiValueFormat
  participant renderExplicitMultiValue
  VALUEToken->>parseValueToken: provide option list and format
  parseValueToken->>scanQuotedCommaList: scan values and comma spacing
  scanQuotedCommaList-->>parseValueToken: return fields and delimiter spacing
  parseValueToken->>resolveMultiValueFormat: resolve inline separator
  resolveMultiValueFormat-->>parseValueToken: return structured multiFormat
  parseValueToken->>renderExplicitMultiValue: pass resolved format and values
  renderExplicitMultiValue-->>VALUEToken: render inline text
Loading

Poem

I’m a rabbit with commas in line,

Spacing now follows the sign.
Compact or wide,
The choices decide,
And rendered selections look fine.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 10 files. (1 skipped:… 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 clearly and concisely describes the main change: format:inline now mimics option-list spacing.
Linked Issues check ✅ Passed The implementation satisfies issue #1701 by inferring comma spacing for VALUE captures, preserving compact or spaced output as specified. Tests and documentation cover the behavior, including quoted c…
Out of Scope Changes check ✅ Passed The changes are limited to the requested formatter behavior, supporting parsing and type updates, documentation, and tests. No unrelated code changes are evident.
Full details: Linked Issues check

Explanation

The implementation satisfies issue #1701 by inferring comma spacing for VALUE captures, preserving compact or spaced output as specified. Tests and documentation cover the behavior, including quoted commas and mixed spacing.

Full details: Docstring Coverage

Explanation

Docstring coverage is 30.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 10 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/inline-format-whitespace-6fe2

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.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying quickadd with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0a16429
Status: ✅  Deploy successful!
Preview URL: https://b9786a68.quickadd.pages.dev
Branch Preview URL: https://cursor-inline-format-whitesp.quickadd.pages.dev

View logs

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] Option to add whitespace between items in format:inline

2 participants