diff --git a/CHANGELOG.md b/CHANGELOG.md index e5ba8928805f82c82d8f67674d26b3d312c9c474..1f73062928b2baa4978cda3cd6f6233d857553c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -71,4 +71,10 @@ ## [0.6.3] -- fixed recognition of failing probcli \ No newline at end of file +- fixed recognition of failing probcli + + + +## [0.6.4] + +- fixed bug where sometimes changes lead to wrong represantation of mistakes \ No newline at end of file diff --git a/README.md b/README.md index 85717d705cca1b8144ebdb673835d5b62a9521db..1122143327cf2b91b37a3a2b16256ab8f6293ead 100644 --- a/README.md +++ b/README.md @@ -104,4 +104,9 @@ Please note that user settings overwrite workspace settings. ### 0.6.3 -- fixed recognition of failing probcli \ No newline at end of file +- fixed recognition of failing probcli + + +### 0.6.4 + +- fixed bug where sometimes changes lead to wrong represantation of mistakes \ No newline at end of file diff --git a/server/src/server.ts b/server/src/server.ts index b6d4acc0efa5a2f59e237a03363712e28ce7470c..47c2b0f2b67a42dc84cd6cc96780a3ee0d9f856a 100644 --- a/server/src/server.ts +++ b/server/src/server.ts @@ -160,6 +160,13 @@ documents.onDidSave(change => { validateTextDocument(change.document) }) +documents.onDidChangeContent(change => { +// validateTextDocument(change.document); +}); + + + + async function validateTextDocument(textDocument: TextDocument): Promise<void> { let settings = await getDocumentSettings(textDocument.uri) // Waiting for correct setting; otherwise allways default @@ -176,8 +183,9 @@ async function validateTextDocument(textDocument: TextDocument): Promise<void> { fs.mkdirSync(errorDic); } - fs.writeFile(errorPath, "", () => { }) //Insure a clean error file + fs.writeFile(errorPath, "", () => { }) //Insure a clean error file + //fs.writeFileSync(errorPath,"",{encoding:'utf8',flag:'w'}) let command: string = getCommand(URI.parse(textDocument.uri).path, errorPath, settings) // console.log(command) if (correctPath(settings.probHome)) { @@ -186,14 +194,19 @@ async function validateTextDocument(textDocument: TextDocument): Promise<void> { errorMap.then(function (result: Map<string, Set<NDJSON>>) { let diagnostics: Array<Diagnostic> = new Array() - - for (let entry of result) { - if (entry[0] == textDocument.uri) { - diagnostics = matchErrors(entry[1], textDocument) - } else { - diagnostics = matchErrors(entry[1]) + if(result.size != 0) + { + for (let entry of result) { + if (entry[0] == textDocument.uri) { + diagnostics = matchErrors(entry[1], textDocument) + } else { + diagnostics = matchErrors(entry[1]) + } + connection.sendDiagnostics({ uri: entry[0], diagnostics }); } - connection.sendDiagnostics({ uri: entry[0], diagnostics }); + } + else{ + connection.sendDiagnostics({ uri: textDocument.uri, diagnostics }); } }, function (err) { @@ -210,6 +223,9 @@ async function validateTextDocument(textDocument: TextDocument): Promise<void> { }) } + + fs.writeFile(errorPath, "", () => { }) //Insure a clean error file + } @@ -271,6 +287,7 @@ connection.onCompletion( + //Can be used to enrich completion with more infos connection.onCompletionResolve( (item: CompletionItem) => { return item })