From d87ce6f97c03dfa948cc62a503ff9a4fcf3bc1be Mon Sep 17 00:00:00 2001 From: SeeBasTStick <sebastian.stock@hhu.de> Date: Thu, 11 Jun 2020 09:55:08 +0200 Subject: [PATCH] added improved error messages when probcli is failing --- .vscode/settings.json | 2 +- README.md | 3 ++- client/src/extension.ts | 2 +- server/src/errorHandler.ts | 5 ++--- server/src/server.ts | 12 +++++++++--- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 3fc0fa6..436b910 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,5 +7,5 @@ "source.fixAll.eslint": true }, "languageServer.wdChecks": false, - "languageServer.probHome": "/home/sebastian/prob_prolog/probcli.sh" + "languageServer.probHome": "/home/sebastian/prb_prolog/probcli.sh" } \ No newline at end of file diff --git a/README.md b/README.md index 9e71085..d28a06a 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,8 @@ Please note that user settings overwrite workspace settings. ## Future plans - Linter Support (via Server, is still in development by Mircosoft https://microsoft.github.io/language-server-protocol/specifications/specification-3-16/) - Quickfix support aká Code Completion -- Add feedback of failing prob cli to output +- Add snipptest +- Make startup time faster - Switch to Java Server ## Release Notes diff --git a/client/src/extension.ts b/client/src/extension.ts index d098da8..121c863 100644 --- a/client/src/extension.ts +++ b/client/src/extension.ts @@ -59,7 +59,7 @@ export function activate(context: ExtensionContext) { client.onReady().then(() => { let bla = window.createOutputChannel("internal_error") client.onNotification("path_error_prob", (message:string) => { - window.showErrorMessage('a problem occured :' + message) + window.showErrorMessage('a problem occured: ' + message) }); client.onNotification("parse_error_prob", (message:string) => { window.showErrorMessage('a error occured :' + message) diff --git a/server/src/errorHandler.ts b/server/src/errorHandler.ts index 7e4d0fb..1abc44d 100644 --- a/server/src/errorHandler.ts +++ b/server/src/errorHandler.ts @@ -24,10 +24,9 @@ export async function readErrors(errorPath: string): Promise<Map<string, Set<NDJ for await (const line of rl) { let obj: NDJSON - + try{ - console.log(line) - obj = JSON.parse(line) + obj = JSON.parse(line) }catch(e){ throw Error(e.message + " at line " + line) } diff --git a/server/src/server.ts b/server/src/server.ts index 946a8ef..0c3b7f4 100644 --- a/server/src/server.ts +++ b/server/src/server.ts @@ -179,8 +179,7 @@ async function validateTextDocument(textDocument: TextDocument): Promise<void> { fs.writeFile(errorPath, "", () => { }) //Insure a clean error file let command: string = getCommand(URI.parse(textDocument.uri).path, errorPath, settings) - - //console.log(command) +// console.log(command) if (correctPath(settings.probHome)) { exec(command, (err: string, stdout: string, stderr: string) => { let errorMap: Promise<Map<string, Set<NDJSON>>> = readErrors(errorPath) @@ -194,13 +193,20 @@ async function validateTextDocument(textDocument: TextDocument): Promise<void> { } else { diagnostics = matchErrors(entry[1]) } - console.log("sending to " + entry[0]) connection.sendDiagnostics({ uri: entry[0], diagnostics }); } }, function (err) { connection.sendNotification("parse_error_prob", "there are things wrong with the parse results " + err) }); + + + if(!stdout.includes('Running ProB Command-line Interface')) + { + connection.sendNotification("path_error_prob", "could not call/reach probcli "+ command) + } + + }) } } -- GitLab