When I switch the editor's language and values, the previous language error markers stick around Microsoft/monaco-editor#475

pull/2748/head
Martin Aeschlimann 2017-06-26 16:53:18 +08:00
parent a3fe14998f
commit 9a25293cce
1 changed files with 4 additions and 1 deletions

View File

@ -84,7 +84,10 @@ export class DiagnostcsAdapter {
return worker.doValidation(resource.toString());
}).then(diagnostics => {
const markers = diagnostics.map(d => toDiagnostics(resource, d));
monaco.editor.setModelMarkers(monaco.editor.getModel(resource), languageId, markers);
let model = monaco.editor.getModel(resource);
if (model.getModeId() === languageId) {
monaco.editor.setModelMarkers(model, languageId, markers);
}
}).done(undefined, err => {
console.error(err);
});