in src/controllers/mainController.ts [285:329]
public onRunCurrentStatement(callbackThis?: MainController): void {
// the 'this' context is lost in retry callback, so capture it here
let self: MainController = callbackThis ? callbackThis : this;
try {
if (!self.canRunCommand()) {
return;
}
if (!self.canRunV2Command()) {
// Notify the user that this is not supported on this version
this._vscodeWrapper.showErrorMessage(LocalizedConstants.macSierraRequiredErrorMessage);
return;
}
if (!self.validateTextDocumentHasFocus()) {
return;
}
// check if we're connected and editing a SQL file
if (self.isRetryRequiredBeforeQuery(self.onRunCurrentStatement)) {
return;
}
Telemetry.sendTelemetryEvent('RunCurrentStatement');
let editor = self._vscodeWrapper.activeTextEditor;
let uri = self._vscodeWrapper.activeTextEditorUri;
let title = path.basename(editor.document.fileName);
// return early if the document does contain any text
if (editor.document.getText(undefined).trim().length === 0) {
return;
}
// only the start line and column are used to determine the current statement
let querySelection: ISelectionData = {
startLine: editor.selection.start.line,
startColumn: editor.selection.start.character,
endLine: 0,
endColumn: 0
};
self._outputContentProvider.runCurrentStatement(self._statusview, uri, querySelection, title);
} catch (err) {
Telemetry.sendTelemetryEventForException(err, 'onRunCurrentStatement');
}
}