Make MDL syntax errors point at the fix, not just the location - #29
Merged
Conversation
Parse errors were precise on line:col but often didn't convey the correct syntax — the sudoku findings repeatedly hit this (#3 "missing THEN at $Cell", plus 30-token `expecting {…}` dumps and cryptic "no viable alternative"). mxcli already had an enhanceErrorMessage layer for ~4 curated cases; this widens it: - Collapse ANTLR's oversized `expecting {…}` token-set dumps. The all-statement- keywords set (~30 internal token names) becomes "expecting the start of a statement (create, alter, drop, show, describe, …)"; any other oversized set is truncated. Small, useful sets (e.g. `expecting ':'`) are left untouched. - Add a precise `not $x` → `not($x)` hint, keyed off the offending source line (the parse error surfaces downstream, so the line is the reliable signal). Scoped to `not $var` to stay false-positive-free (won't fire on `not(...)`, `is not null`, etc.). - Append a one-line `[see: mxcli syntax <topic>]` pointer on any error that didn't match a specific hint, so the correct form is one command away. The error listener now keeps the source lines so hints can inspect the offending line. Tests: token-dump collapse, small-set preserved, bare-not hint (unit + end-to-end via Build), plus the existing apostrophe/grant/enum assertions updated to match on their specific hint text rather than "message changed". Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JXnEgoc2NQP1Y2TWMCMXC4
ako
pushed a commit
that referenced
this pull request
Jul 28, 2026
Verification round found that the #27 narrowing wrongly treated `Paragraph` render mode as block-level. On Mendix 11.12.1 + Atlas a Paragraph-mode dynamictext renders as an inline `<span>`, so two adjacent Paragraph widgets fuse (`PARA-ONEPARA-TWO`) exactly like Text-mode ones — and the advisory was silently missing them. `inlineDynamicText` now treats ONLY H1–H6 as block-level (`headingRenderModeRe`); Text/unset and Paragraph are both inline. The advisory message is corrected to recommend a heading RenderMode (not Paragraph, which does not fix the problem). Tests updated: Paragraph+Paragraph and Paragraph+Text now flagged, heading pairs still excluded. Repro ledger-27 extended to show all three cases. Symptom table notes the lesson: verify Mendix render behavior empirically — a name like "Paragraph" does not imply `display: block`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JXnEgoc2NQP1Y2TWMCMXC4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Answers "do MDL syntax errors give enough info to know the correct syntax?" — before this, partly: a curated set of ~4 mistakes got a great message, but the rest fell through to raw ANTLR (precise location, but noisy
expecting {30 tokens}dumps, cryptic "no viable alternative", and misattributed "missing THEN at$Cell"). This widens the existingenhanceErrorMessagelayer.Changes
Collapse the token-set dumps. ANTLR's statement-start failure lists ~30 internal token names:
→ now:
Other oversized sets are truncated; small useful sets (
expecting ':') are left intact.Precise
not $x→not($x)hint (findings Multi-version pluggable widgets: resolve CE0463 generically, addwidget describe, docs #3). Keyed off the offending source line (the parse error surfaces downstream as "missing THEN at$x"), scoped tonot $varso it never false-fires onnot(...),is not null, etc.:A
[see: mxcli syntax <topic>]pointer on any error that didn't match a specific hint — always a route to the correct form.Notes
=, misplacedextends, unescaped apostrophe, reserved keyword) are unchanged.Build); the apostrophe/grant/enum tests were updated to assert on their specific hint text rather than "message changed" (since the generic pointer now always appends).make check-mdlgreen; visitor + executor suites pass.🤖 Generated with Claude Code
Generated by Claude Code