diff --git a/src/views/results/index.ts b/src/views/results/index.ts index e5fb0f59..806a34b6 100644 --- a/src/views/results/index.ts +++ b/src/views/results/index.ts @@ -251,16 +251,18 @@ export function parseStatement(editor: vscode.TextEditor): StatementInfo { if (group) { content = text.substring(group.range.start, group.range.end); editor.selection = new vscode.Selection(editor.document.positionAt(group.range.start), editor.document.positionAt(group.range.end)); + } + } - [`cl`, `json`, `csv`, `sql`].forEach(mode => { - if (content.trim().toLowerCase().startsWith(mode + `:`)) { - content = content.substring(mode.length + 1).trim(); + if (content) { + [`cl`, `json`, `csv`, `sql`].forEach(mode => { + if (content.trim().toLowerCase().startsWith(mode + `:`)) { + content = content.substring(mode.length + 1).trim(); - //@ts-ignore We know the type. - type = mode; - } - }); - } + //@ts-ignore We know the type. + type = mode; + } + }); } return {