From 135cd8afbe50d56a5757dde9694c361dcfbafb0c Mon Sep 17 00:00:00 2001 From: ZacNugent Date: Mon, 12 Nov 2018 21:36:52 +0000 Subject: [PATCH] Add some error details --- src/extension.ts | 7 +++---- src/repl.ts | 18 +++++++++--------- src/smallcommands.ts | 8 ++++---- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index 34e6f943a..42f00bc6b 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -134,8 +134,7 @@ async function startLanguageServer() { var originalJuliaPkgDir = await packagepath.getPkgPath(); } catch (e) { - - vscode.window.showErrorMessage('Could not start the julia language server. Make sure the configuration setting julia.executablePath points to the julia binary.'); + vscode.window.showErrorMessage('Could not start the julia language server. Make sure the configuration setting julia.executablePath points to the julia binary. [startLanguageServer 1]'); vscode.window.showErrorMessage(e) return; } @@ -176,8 +175,8 @@ async function startLanguageServer() { setLanguageClient(g_languageClient); } catch (e) { - - vscode.window.showErrorMessage('Could not start the julia language server. Make sure the configuration setting julia.executablePath points to the julia binary.'); + vscode.window.showErrorMessage('Could not start the julia language server. Make sure the configuration setting julia.executablePath points to the julia binary. [startLanguageServer 2]'); + vscode.window.showErrorMessage(e) g_languageClient = null; } diff --git a/src/repl.ts b/src/repl.ts index bd0e36905..d6b7477be 100644 --- a/src/repl.ts +++ b/src/repl.ts @@ -336,7 +336,7 @@ async function executeFile() { async function selectJuliaBlock() { if (g_languageClient == null) { - vscode.window.showErrorMessage('Error: Language server is not running.'); + vscode.window.showErrorMessage('Error: Language server is not running. [selectJuliaBlock]'); } else { var editor = vscode.window.activeTextEditor; @@ -347,12 +347,12 @@ async function selectJuliaBlock() { vscode.window.activeTextEditor.selection = new vscode.Selection(vscode.window.activeTextEditor.document.positionAt(ret_val[0] - 1), vscode.window.activeTextEditor.document.positionAt(ret_val[1])) vscode.window.activeTextEditor.revealRange(new vscode.Range(vscode.window.activeTextEditor.document.positionAt(ret_val[0] - 1), vscode.window.activeTextEditor.document.positionAt(ret_val[1]))) } - catch (ex) { - if (ex.message == "Language client is not ready yet") { + catch (e) { + if (e.message == "Language client is not ready yet") { vscode.window.showErrorMessage('Select code block only works once the Julia Language Server is ready.'); } else { - throw ex; + throw e; } } } @@ -362,7 +362,7 @@ async function executeJuliaBlockInRepl() { telemetry.traceEvent('command-executejuliablockinrepl'); if (g_languageClient == null) { - vscode.window.showErrorMessage('Error: Language server is not running.'); + vscode.window.showErrorMessage('Error: Language server is not running. [executeJuliaBlockInRepl]'); } else { var editor = vscode.window.activeTextEditor; @@ -375,12 +375,12 @@ async function executeJuliaBlockInRepl() { vscode.window.activeTextEditor.selection = new vscode.Selection(vscode.window.activeTextEditor.document.positionAt(ret_val[2]), vscode.window.activeTextEditor.document.positionAt(ret_val[2])) vscode.window.activeTextEditor.revealRange(new vscode.Range(vscode.window.activeTextEditor.document.positionAt(ret_val[2]), vscode.window.activeTextEditor.document.positionAt(ret_val[2]))) } - catch (ex) { - if (ex.message == "Language client is not ready yet") { + catch (e) { + if (e.message == "Language client is not ready yet") { vscode.window.showErrorMessage('Execute code block only works once the Julia Language Server is ready.'); } else { - throw ex; + throw e; } } } @@ -393,7 +393,7 @@ async function sendMessage(cmd, msg: string) { let conn = net.connect(sock) let outmsg = cmd + '\n' + msg + "\nrepl/endMessage"; conn.write(outmsg) - conn.on('error', () => { vscode.window.showErrorMessage("REPL is not open") }) + conn.on('error', () => { vscode.window.showErrorMessage("REPL is not open [sendMessage]") }) } export interface TextDocumentPositionParams { diff --git a/src/smallcommands.ts b/src/smallcommands.ts index 6369b6c0c..4504826a4 100644 --- a/src/smallcommands.ts +++ b/src/smallcommands.ts @@ -50,7 +50,7 @@ function toggleServerLogs() { telemetry.traceEvent('command-juliatogglelog'); if (g_languageClient == null) { - vscode.window.showErrorMessage('Error: Lanuage server is not yet running.'); + vscode.window.showErrorMessage('Error: Lanuage server is not yet running. [toggleServerLogs 1]'); } else { try { @@ -58,7 +58,7 @@ function toggleServerLogs() { } catch (ex) { if (ex.message == "Language client is not ready yet") { - vscode.window.showErrorMessage('Error: server is not running.'); + vscode.window.showErrorMessage('Error: server is not running. [toggleServerLogs 2]'); } else { throw ex; @@ -71,7 +71,7 @@ function toggleFileLint(arg) { telemetry.traceEvent('command-juliatogglefilelint'); if (g_languageClient == null) { - vscode.window.showErrorMessage('Error: Lanuage server is not yet running.'); + vscode.window.showErrorMessage('Error: Lanuage server is not yet running. [toggleFileLint 1]'); } else { try { @@ -80,7 +80,7 @@ function toggleFileLint(arg) { catch (ex) { 5 if (ex.message == "Language client is not ready yet") { - vscode.window.showErrorMessage('Error: server is not running.'); + vscode.window.showErrorMessage('Error: server is not running. [toggleFileLint 1]'); } else { throw ex;