Skip to content

Commit 29332f6

Browse files
committed
docs(specs): amend #177 spec — add QuickPick validation severity feedback
Blue border (Info) on resolved parse, yellow (Warning) on ambiguous, none on free-text-only. Uses QuickInputSeverity, available since 1.70. #177
1 parent 0d034ea commit 29332f6

1 file changed

Lines changed: 28 additions & 1 deletion

File tree

docs/specs/2026-06-01-177-smart-input-parser.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,29 @@ Concretely:
7070

7171
This approach has zero external dependencies, keeps locale data declarative, makes every token type independently unit-testable, and mirrors the existing code structure closely enough to minimize migration risk.
7272

73+
## Visual feedback via QuickPick validation severity
74+
75+
The tokenizer produces a typed `Token[]` stream, which makes parse confidence explicit for the first time. Use that to drive `validationMessage` on the existing `QuickPick` in `Dialogues` (`src/vscode/dialogues.ts`):
76+
77+
| Tokenizer result | `validationMessage.severity` | Border color | Condition |
78+
|-----------------|------------------------------|--------------|-----------|
79+
| All tokens resolved, date unambiguous | `QuickInputSeverity.Info` | Blue | Happy path — recognized date/offset/weekday |
80+
| Partial match or ambiguous prefix | `QuickInputSeverity.Warning` | Yellow | e.g. `mar` could be March or martes or mars |
81+
| No structured token, free text only | none (clear message) | Default | User is typing a memo/note title, not a date |
82+
83+
```ts
84+
// in the onDidChangeValue handler, after parseInput() resolves:
85+
input.validationMessage = confidence === 'resolved'
86+
? { message: descriptionText, severity: QuickInputSeverity.Info }
87+
: confidence === 'ambiguous'
88+
? { message: descriptionText, severity: QuickInputSeverity.Warning }
89+
: undefined;
90+
```
91+
92+
`QuickInputSeverity` is the correct enum for `QuickPick` (not `InputBoxValidationSeverity`). Available since VS Code 1.70; well below the extension's 1.118 minimum.
93+
94+
The tokenizer must expose a `confidence` field (or equivalent) on its result: `'resolved' | 'ambiguous' | 'text-only'`. This is the only new public surface added by the visual-feedback slice.
95+
7396
## Acceptance criteria
7497

7598
### Design phase (this spec)
@@ -86,6 +109,7 @@ This approach has zero external dependencies, keeps locale data declarative, mak
86109
- A new property-based test suite (`src/test/suite/match-input-vocab.test.ts`) sweeps all weekday and month abbreviations across all supported locales and asserts no false-positive match against a corpus of common everyday words that share prefixes.
87110
- `npm run check` (lint + compile + full test) green on CI.
88111
- No change to the exported `Input` type or the `parseInput(inputString: string): Promise<Input>` signature.
112+
- `QuickPick` shows blue border (`QuickInputSeverity.Info`) on unambiguous parse, yellow border (`QuickInputSeverity.Warning`) on ambiguous parse, no border on free-text-only input.
89113

90114
## Migration plan
91115

@@ -105,6 +129,9 @@ No feature-flag needed — the parallel phase is purely internal to `parseInput(
105129
| New vocab property-based sweep | Zero false-positive weekday/month matches |
106130
| `npm run check` | Green |
107131
| Bundle size delta | < +2 kB minified (zero external deps) |
132+
| Visual feedback — blue border on resolved parse | Pass |
133+
| Visual feedback — yellow border on ambiguous parse | Pass |
134+
| Visual feedback — no border on free-text input | Pass |
108135

109136
## Constraints
110137

@@ -115,7 +142,7 @@ No feature-flag needed — the parallel phase is purely internal to `parseInput(
115142

116143
## Out of scope
117144

118-
- QuickPick/InputBox surface changes.
145+
- Structural changes to QuickPick/InputBox layout, item format, or command wiring (color severity feedback via `validationMessage` IS in scope — see above).
119146
- Localization of UI strings (handled by `vscode.l10n`, issue #176).
120147
- Moment.js removal (PLAN.md Phase 3).
121148
- Adding new syntax forms (tracked separately in #230 — but the new tokenizer must be extensible enough to absorb those changes without structural surgery).

0 commit comments

Comments
 (0)