Skip to content

feat: visually mark grammar-engine keys when the experimental flag is on (#467)#474

Open
SJrX wants to merge 1 commit into
issue-345-5from
issue-345-6
Open

feat: visually mark grammar-engine keys when the experimental flag is on (#467)#474
SJrX wants to merge 1 commit into
issue-345-5from
issue-345-6

Conversation

@SJrX

@SJrX SJrX commented Jun 21, 2026

Copy link
Copy Markdown
Owner

What

A small debug aid: while the experimental grammar engine is enabled, the key of any option whose value is validated by the new engine (a GrammarOptionValue) is visually marked, so it's obvious at a glance which keys run on the new parse() path versus the original SyntacticMatch/SemanticMatch one.

Stacked on #472 (issue-345-5). Motivation: avoid wasting time testing keys that aren't actually on the new path — e.g. in a .network file [Network] DHCP= (grammar-backed) will be marked while [Network]-style boolean keys won't.

How

  • GrammarEngineKeyAnnotator — when useGrammarParseEngine is on, resolves each property's validator (same lookup the inspection uses: file class + section + key) and, if it's a GrammarOptionValue, adds an INFORMATION-level annotation on the key with a distinct, theme-aware (METADATA-tinted) text attribute. When the flag is off it returns immediately, so there's no effect for normal users.
  • Not configurable, by request — it's a development tell, gated on the same flag that turns the engine on.

Test note

GrammarParseEngineInspectionTest (from #472) now counts only non-INFORMATION highlights, because this annotator — keyed off the same flag — also marks the keys, which would otherwise inflate the inspection's highlight counts. Engine/inspection behavior is unchanged; full suite green.

Refs #467

🤖 Generated with Claude Code

A debug aid: while useGrammarParseEngine is enabled, an annotator marks the KEY of
every option whose value is validated by the new engine (a GrammarOptionValue), so
it's obvious at a glance which keys run on the new parse() path vs the original one.
This avoids wasting time poking at keys that aren't actually on the new path.

- GrammarEngineKeyAnnotator: when the flag is on, resolves each property's validator
  and, if it is a GrammarOptionValue, adds an INFORMATION-level annotation on the key
  with a distinct (METADATA-tinted) text attribute. No-op when the flag is off, so no
  effect for normal users. Not configurable, by request.
- Adjusts GrammarParseEngineInspectionTest to count only non-INFORMATION highlights,
  since the annotator (same flag) now also marks the keys.

Refs #467

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

Copy link
Copy Markdown

Test Results

1 123 tests  +2   1 123 ✅ +2   55s ⏱️ -1s
  297 suites +1       0 💤 ±0 
  297 files   +1       0 ❌ ±0 

Results for commit 4a3707d. ± Comparison against base commit 26877c2.

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.

1 participant