Skip to content

feat: support space-separated quoted strings as widget arguments#104

Merged
rohal12 merged 1 commit intomainfrom
feat/space-separated-widget-args
Mar 22, 2026
Merged

feat: support space-separated quoted strings as widget arguments#104
rohal12 merged 1 commit intomainfrom
feat/space-separated-widget-args

Conversation

@rohal12
Copy link
Owner

@rohal12 rohal12 commented Mar 22, 2026

Summary

  • Adjacent quoted string literals can now be passed as separate widget arguments without commas: {choice "Label" "target"} works alongside the existing {choice "Label", "target"} syntax
  • Only activates when all arguments are quoted strings and no commas are present — expressions with variables or operators still require commas
  • Updated widget docs and macro reference to document both syntaxes

Closes #103

How it works

When splitArgs() finds no top-level commas in the raw argument string, it attempts to parse the input as adjacent quoted string literals ("..." or '...') separated by whitespace. If the entire input is consumed and 2+ strings are found, they're returned as individual arguments. Otherwise, the original single-expression behavior is preserved.

Test plan

  • 16 unit tests covering comma splitting (unchanged), space-separated quoted strings, fallback cases, and edge cases
  • Full test suite passes (926 tests)
  • Type-check passes (tsc --noEmit)

🤖 Generated with Claude Code

Adjacent quoted string literals can now be passed as separate widget
arguments without commas: {choice "Label" "target"} works alongside
the existing {choice "Label", "target"} syntax. Applies only when all
arguments are quoted strings — expressions with variables or operators
still require commas.

Closes #103

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link

Release preview: merging this PR will publish v0.33.0 (minor bump from v0.32.1)

@rohal12 rohal12 enabled auto-merge March 22, 2026 13:07
@github-actions
Copy link

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 79.37% 2432 / 3064
🔵 Statements 78.4% 2662 / 3395
🔵 Functions 70.96% 435 / 613
🔵 Branches 74.1% 1339 / 1807
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/components/macros/WidgetInvocation.tsx 93.54% 93.44% 62.5% 97.5% 38, 54, 145, 147, 191
Generated in workflow #171 for commit 472800e by the Vitest Coverage Report Action

@rohal12 rohal12 merged commit a907cfb into main Mar 22, 2026
5 checks passed
@rohal12 rohal12 deleted the feat/space-separated-widget-args branch March 22, 2026 13:09
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 space-separated quoted strings as widget arguments

1 participant