Repository navigation
feat(sql-workspace): caret at the error position, one error panel for SQL and Mongo (#1557) - #1726
Merged
Merged
Conversation
…ror position; the Mongo query error uses the same panel (#1557)
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.
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:
Causing statement (at position N), a byte offset into the statement it prepared, which is the app'sSELECT * 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).ServerException.position(1-based, characters); the row limit the app appends comes after the text, so nothing shifts.QueryErrorText.offsetIn(error, sql)does the mapping;offsetOfPgPositionis its PostgreSQL half, separate becauseServerExceptioncannot be built in a test.4. One error panel. The headline / Show details / Copy error panel moved from
ResultsTabintoQueryErrorView(shared/widgets).ResultsTabuses it as before, and the Mongo query workspace now shows itsQuery Errorthrough it too (aninlinevariant 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).