fix(sql): keep Ctrl+Enter on current statement at trailing whitespace
This commit is contained in:
1 parent
c32f92a902
commit
b437c470e1
4 files changed
+177
-4
No files matched your search
@@ -62,8 +62,9 @@ export function executableStatementRangeAtCursor(cache: ExecutableStatementRange
|
||||
}
|
||||
|
||||
const next = cache.ranges[index + 1];
|
||||
if (pos > range.to && (!next || pos < next.from) && cursorBelongsToTrailingStatementDelimiter(cache.doc, range.to, pos)) {
|
||||
return range;
|
||||
if (pos > range.to && (!next || pos < next.from)) {
|
||||
if (cursorBelongsToTrailingStatementDelimiter(cache.doc, range.to, pos)) return range;
|
||||
if (isCursorOnRangeEndLine(cache.doc, pos, range.to)) return range;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,3 +82,8 @@ function isCursorOnLeadingBlockComment(lineText: string, lineOffset: number): bo
|
||||
|
||||
return lineOffset <= commentEnd + 2;
|
||||
}
|
||||
|
||||
function isCursorOnRangeEndLine(doc: Text, pos: number, rangeTo: number): boolean {
|
||||
const line = doc.lineAt(pos);
|
||||
return rangeTo >= line.from && rangeTo <= line.to;
|
||||
}
|
||||
Reference in new issue
Block a user