Skip to content

Commit da0d941

Browse files
committed
Fix for running pre-selected statement that was for a specific type
1 parent 2d85aa3 commit da0d941

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/views/results/index.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -251,16 +251,18 @@ export function parseStatement(editor: vscode.TextEditor): StatementInfo {
251251
if (group) {
252252
content = text.substring(group.range.start, group.range.end);
253253
editor.selection = new vscode.Selection(editor.document.positionAt(group.range.start), editor.document.positionAt(group.range.end));
254+
}
255+
}
254256

255-
[`cl`, `json`, `csv`, `sql`].forEach(mode => {
256-
if (content.trim().toLowerCase().startsWith(mode + `:`)) {
257-
content = content.substring(mode.length + 1).trim();
257+
if (content) {
258+
[`cl`, `json`, `csv`, `sql`].forEach(mode => {
259+
if (content.trim().toLowerCase().startsWith(mode + `:`)) {
260+
content = content.substring(mode.length + 1).trim();
258261

259-
//@ts-ignore We know the type.
260-
type = mode;
261-
}
262-
});
263-
}
262+
//@ts-ignore We know the type.
263+
type = mode;
264+
}
265+
});
264266
}
265267

266268
return {

0 commit comments

Comments
 (0)