Skip to content

feat(sql-workspace): caret at the error position, one error panel for SQL and Mongo (#1557) - #1726

Merged
ZhuchkaTriplesix merged 1 commit into
devfrom
feat/query-error-position
Oct 18, 2026
Merged

ZhuchkaTriplesix merged 1 commit into
devfrom
feat/query-error-position

Conversation

@ZhuchkaTriplesix

Copy link
Copy Markdown
Member

Closes #1557 (the parts #1701 left: items 3 and 4)

3. The caret goes to the error. When one statement fails and the driver says where, the editor's caret moves to that place in the user's own text:

  • SQLite gives Causing statement (at position N), a byte offset into the statement it prepared, which is the app's SELECT * FROM (\n<sql>\n) wrapper (fix(sqlite): columns with the same name collapse into one in query results #1144); the wrapper's 16 characters are taken off and the bytes turned into characters (a é before the error does not shift it).
  • PostgreSQL gives ServerException.position (1-based, characters); the row limit the app appends comes after the text, so nothing shifts.
  • MySQL gives none; the caret stays where it was.
  • Leading blank lines of the run text and the statement's start inside a selection or script are counted, and the caret is clamped if the text was edited during the run. Failures in a multi-statement run already moved the caret to the failed statement.
    QueryErrorText.offsetIn(error, sql) does the mapping; offsetOfPgPosition is its PostgreSQL half, separate because ServerException cannot be built in a test.

4. One error panel. The headline / Show details / Copy error panel moved from ResultsTab into QueryErrorView (shared/widgets). ResultsTab uses it as before, and the Mongo query workspace now shows its Query Error through it too (an inline variant for the box it sits in): the driver message as the headline, the rest folded, and Copy.

Not done: a squiggle under the error. The caret and the selection do the job of finding it; an underline needs a decoration layer in the editor, which is its own change.

Tests: query_error_text_test (SQLite with and without the wrapper, bytes vs characters, outside the text, MySQL, PostgreSQL positions), generic_sql_workspace_error_caret_test (the caret lands on the column, blank lines are counted, no position leaves the caret), query_error_view_test (headline, details, copy, inline, reset on a new error). The existing results-tab and Mongo query tests pass unchanged; workspace, mongodb, database and shared tests pass locally (1464).

…ror position; the Mongo query error uses the same panel (#1557)
@github-actions github-actions Bot added enhancement New feature or request error-handling Theme parser epic label: error-handling ui User interface components and widgets ux User experience, keyboard shortcuts and interactions P2 Medium priority / Parity & Refactoring labels Oct 18, 2026
@ZhuchkaTriplesix
ZhuchkaTriplesix merged commit 9081695 into dev Oct 18, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request error-handling Theme parser epic label: error-handling P2 Medium priority / Parity & Refactoring ui User interface components and widgets ux User experience, keyboard shortcuts and interactions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant