Repository navigation
feat(sql): run the statement at the cursor, splitter with offsets (#1148) - #1186
Merged
Merged
Conversation
) SqlStatementSplitter returns statement ranges (start, end, line) and picks the statement at a caret: inside a statement, a caret on a blank line or after the last ; takes the statement above. Semicolons inside string literals, quoted identifiers, comments and PostgreSQL dollar quotes do not end a statement. DestructiveSqlDetector.splitStatements is built on the same scanner. Ctrl/Cmd+Enter, Ctrl/Cmd+R and numpad Enter run the selection or the statement at the cursor. F5 and Ctrl/Cmd+Shift+Enter run the selection or the whole script.
Grid scroll benchmark
Informational only (threshold 5%). Shared CI runners are noisy; re-run before trusting a single result. |
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.
Refs #1148
Changes
SqlStatementSplitterreturns statement ranges (start, end, line). Semicolons inside string literals, quoted identifiers, comments and PostgreSQL dollar quotes do not end a statement.SqlStatementSplitter.at(spans, offset): a caret inside a statement picks it; a caret on a blank line or after the last;takes the statement above.DestructiveSqlDetector.splitStatementsis built on the same scanner, so the destructive check and the cursor lookup split the same way.;, before the first statement, and in an empty script.Not in this PR
Statement k of n failed (line L)— the driver still receives the whole script as one string.🤖 Generated with Claude Code