Skip to content

Commit

Permalink
Add some error details
Browse files Browse the repository at this point in the history
  • Loading branch information
ZacLN committed Nov 12, 2018
1 parent c7c6831 commit 135cd8a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
7 changes: 3 additions & 4 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}

Expand Down
18 changes: 9 additions & 9 deletions src/repl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
}
}
Expand All @@ -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;
Expand All @@ -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;
}
}
}
Expand All @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions src/smallcommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ 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 {
g_languageClient.sendRequest("julia/toggle-log");
}
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;
Expand All @@ -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 {
Expand All @@ -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;
Expand Down

0 comments on commit 135cd8a

Please sign in to comment.