Skip to content
Snippets Groups Projects
Commit 6bc2407f authored by SeeBasTStick's avatar SeeBasTStick
Browse files

fixed a bug

where the main file was not updated when there were errors in a subfile but no more errors in the main file
parent 0b4383be
No related branches found
No related tags found
No related merge requests found
......@@ -7,5 +7,5 @@
"source.fixAll.eslint": true
},
"languageServer.wdChecks": false,
"languageServer.probHome": "/home/sebastian/prb_prolog/probcli.sh"
"languageServer.probHome": "/home/sebastian/prob_prolog/probcli"
}
\ No newline at end of file
......@@ -98,7 +98,7 @@ export function matchErrors(infos: Set<NDJSON>, file?: TextDocument | undefined)
}
},
message: content.message,
source: 'prob_prolog',
source: content.file,
};
......
......@@ -22,6 +22,8 @@ import * as fs from 'fs';
import { NDJSON, readErrors, matchErrors } from './errorHandler';
import * as wordComplition from './wordCompletion'
import * as path from 'path';
import * as URL from 'url'
//import * as uri2path from 'file-uri-to-path'
......@@ -196,19 +198,43 @@ async function validateTextDocument(textDocument: TextDocument): Promise<void> {
let diagnostics: Array<Diagnostic> = new Array()
if(result.size != 0)
{
let mainFileWritten : boolean = false;
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 });
/**
* TL;DR we need to cast here to clean the main file
*
* This is a little bit of a mess here: Problem the paths in the _error.json a system relevant
* and system centered e.g. /home/sebastian...
*
* The URI from the textdocument is domain centered e.g. file///home/sebastian in order to deal
* with remote files like serverXYZ///home/michael
*
* However the extension.ts can deal with system centric paths and uris, but we need a comparision
* so we have to cast here...
*/
if(URI.parse(entry[0]).toString() == textDocument.uri){
mainFileWritten = true
}
}
if(mainFileWritten == false){
// The main file has no errors, we need to reset it...
diagnostics = new Array()
connection.sendDiagnostics({ uri: textDocument.uri, diagnostics });
}
}
else{
connection.sendDiagnostics({ uri: textDocument.uri, diagnostics });
}
}, function (err) {
connection.sendNotification("parse_error_prob", "there are things wrong with the parse results " + err)
});
......@@ -219,8 +245,6 @@ async function validateTextDocument(textDocument: TextDocument): Promise<void> {
connection.sendNotification("path_error_prob", "could not call/reach probcli "+ command)
}
console.log(command)
})
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment