From aed27e72be264a26864fae6ae104056a4a1f8aeb Mon Sep 17 00:00:00 2001 From: Thorsten Muerell Date: Tue, 7 Nov 2017 08:56:51 +0100 Subject: [PATCH] Small changes --- package.json | 8 ++++---- src/sessionmanager.ts | 7 +++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index e578223..a7b0860 100644 --- a/package.json +++ b/package.json @@ -20,19 +20,19 @@ "commands": [ { "command": "frog.executeSnippet", - "title": "Execute SQL Snippet" + "title": "Frog: Execute SQL Snippet" }, { "command": "frog.compileFile", - "title": "Compiles the current file" + "title": "Frog: Compiles the current file" }, { "command": "frog.selectConnection", - "title": "Selects the connection to use" + "title": "Frog: Selects the connection to use" }, { "command": "frog.setRowLimit", - "title": "Sets the row limit" + "title": "Frog: Sets the row limit" } ], "keybindings": [ diff --git a/src/sessionmanager.ts b/src/sessionmanager.ts index 97bbd36..61a1dcb 100644 --- a/src/sessionmanager.ts +++ b/src/sessionmanager.ts @@ -69,6 +69,8 @@ export class SessionManager { try { let json = JSON.parse(outputBuffer); + const editor = vscode.window.activeTextEditor; + const document = editor.document; const diagnostics = []; let cd = json['columnDefinitions'] @@ -79,9 +81,6 @@ export class SessionManager { if (json['userErrors']) { this.outputChannel.append("Errors found:\n"); - const editor = vscode.window.activeTextEditor; - const document = editor.document; - for (let error of json['userErrors'][0]['lines']) { let range = document.lineAt(editor.selection.start.line + error['line'] - 1).range; let diagnostic = new vscode.Diagnostic(range, error['text'], vscode.DiagnosticSeverity.Error); @@ -91,7 +90,6 @@ export class SessionManager { this.outputChannel.append(error['line'] + ": " + error['text'] + "\n"); } - this.diagnosticCollection.set(document.uri, diagnostics); } else if (json['exception']) { this.outputChannel.append("Exception caught: " + json['exceptionMessage'] + "\n"); } else if ("affectedRows" in json) { @@ -111,6 +109,7 @@ export class SessionManager { this.outputChannel.append("Query successful.\n"); } + this.diagnosticCollection.set(document.uri, diagnostics); this.outputChannel.append("-- " + new Date() + " -------------------------------\n"); outputBuffer = ""; this.statusBarItem.text = this.currentConnection.name + " (Connected)";