Skip to content

fix(editor): Format errors show in the results panel + caret jumps to them#36

Merged
BorisTyshkevich merged 2 commits into
mainfrom
fix/format-error-in-panel
Jun 25, 2026
Merged

fix(editor): Format errors show in the results panel + caret jumps to them#36
BorisTyshkevich merged 2 commits into
mainfrom
fix/format-error-in-panel

Conversation

@BorisTyshkevich

Copy link
Copy Markdown
Collaborator

What

A Format ({} / ⌘⇧↵) syntax error now shows persistently in the results panel and the editor caret jumps to the offending token — instead of a brief toast that vanished before you could read it.

Behavior

  • Error: the panel shows a concise message (e.g. Syntax error: failed at position 18 (BEWEEN): BEWEEN 2 AND 3 — Code/DB preamble and the long "Expected one of: …" tail trimmed) and stays; the caret moves to (and scrolls to) the position; the editor text is untouched.
  • Success: reformats as before and clears a prior format error from the panel. Real run results are never cleared on success (a formatError flag tells them apart).

How

  • core/stream.js (pure, tested): parseErrorPos(msg) → 0-based caret offset from CH's "position N" (1-based, relative to the query, newlines counted → caret N-1; the raw untrimmed SQL is sent so it maps 1:1); summarizeError(msg) → condensed message.
  • ui/editor.js: app.dom.editorRevealCaret(pos) — focus, set caret, scroll the line into view.
  • ui/app.js formatQuery(): error → set tab.result.error (+formatError flag) + reveal caret; success → clear a prior format error.

Tests

753 unit tests pass; stream.js 100%, editor.js/app.js within the gate. CI also runs the Playwright e2e (Chromium + Firefox).

🤖 Generated with Claude Code

BorisTyshkevich and others added 2 commits June 25, 2026 10:48
… to them

A formatQuery() syntax error was shown in a brief, easily-missed toast. Now it
renders persistently in the results panel (summarized — dropping the
"Code: N. DB::Exception:" preamble and the huge "Expected one of: …" tail) and
the editor caret jumps to, and scrolls to, the offending position. ClickHouse
reports a 1-based offset into the query (newlines counted), so the raw (untrimmed)
SQL is sent and the caret lands at N-1. A later successful format clears that
error; real run results are never cleared on success (a `formatError` flag
distinguishes them).

Adds pure parseErrorPos/summarizeError (core/stream.js) and app.dom.editorRevealCaret
(editor.js). 753 tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QGBS74oUsXarGkCRQKEFLu
Drop summarizeError — the format-error path now puts the original exception
text (Code/DB prefix + "Expected one of: …" tail) into the results panel
verbatim. Caret-to-position and clear-on-success unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QGBS74oUsXarGkCRQKEFLu
@BorisTyshkevich BorisTyshkevich merged commit 60f1dc7 into main Jun 25, 2026
4 checks passed
@BorisTyshkevich BorisTyshkevich deleted the fix/format-error-in-panel branch June 25, 2026 09:03
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