Fix for "Run Current Query" keybind no longer behaving as expected (#10538) (#10557)

* -"Run current" command runs the entire selection instead of only first statement in the selection

* -brought some logic back from the  old code to correct the behavior

* -Added unit tests for runCurrent command

* -Fixed a comment

* - Added checks for run input parameters

* -Added some extra checks

* -Fixed some spacing issue

* Changed to using verify instead of a counter variable
This commit is contained in:
Aasim Khan
2020-06-08 14:42:07 -07:00
committed by GitHub
parent 57201fe6c7
commit 75e3e4c8c9
2 changed files with 125 additions and 2 deletions

View File

@@ -242,8 +242,8 @@ export class RunQueryAction extends QueryTaskbarAction {
if (this.isConnected(editor)) {
// if the selection isn't empty then execute the selection
// otherwise, either run the statement or the script depending on parameter
let selection = editor.getSelection();
if (runCurrentStatement && selection) {
let selection = editor.getSelection(false);
if (runCurrentStatement && selection && this.isCursorPosition(selection)) {
editor.input.runQueryStatement(selection);
} else {
// get the selection again this time with trimming
@@ -252,6 +252,11 @@ export class RunQueryAction extends QueryTaskbarAction {
}
}
}
protected isCursorPosition(selection: IRange) {
return selection.startLineNumber === selection.endLineNumber
&& selection.startColumn === selection.endColumn;
}
}
/**