Part of Phase 1 — Core skeleton (tasks.md Task 1.4).
Summary
Implement tecode.context (flat context map) and the when-clause parser/evaluator used by keybindings and command visibility.
Details
- Context service:
set(key, value) / get(key) over a flat Map<string, unknown> with a change event. - Recursive-descent parser for the MVP grammar (design.md §6.4):
expr := or
or := and ("||" and)*
and := unary ("&&" unary)*
unary := "!" unary | primary
primary:= key | key "==" value | "(" expr ")"
- Clauses parse once into a cached AST at registration; evaluation runs per lookup.
- Unknown context keys evaluate to
undefined (falsy). Malformed clauses fail at parse time with a clear error (binding is skipped and reported, not crashing).
Completion requirements
References
- requirements.md: Req 4.5, 4.6
- design.md: §6.4
Dependencies
Blocked by: 1.2 (#3). Parallelizable with 1.3, 1.5–1.10.
Part of Phase 1 — Core skeleton (tasks.md Task 1.4).
Summary
Implement
tecode.context(flat context map) and thewhen-clause parser/evaluator used by keybindings and command visibility.Details
set(key, value)/get(key)over a flatMap<string, unknown>with a change event.undefined(falsy). Malformed clauses fail at parse time with a clear error (binding is skipped and reported, not crashing).Completion requirements
==string comparison (editorLangId == 'ts'),!,&&/||precedence, parentheses, unknown keys falsy, malformed inputsetwith changed keybun testand lint passReferences
Dependencies
Blocked by: 1.2 (#3). Parallelizable with 1.3, 1.5–1.10.