mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 11:35:40 +01:00
When I switch the editor's language and values, the previous language error markers stick around. Fixes Microsoft/monaco-editor#475
This commit is contained in:
parent
9d724f1e05
commit
3cac4e7522
1 changed files with 4 additions and 1 deletions
|
|
@ -92,7 +92,10 @@ export class DiagnostcsAdapter {
|
||||||
this._worker(resource).then(worker => {
|
this._worker(resource).then(worker => {
|
||||||
return worker.doValidation(resource.toString()).then(diagnostics => {
|
return worker.doValidation(resource.toString()).then(diagnostics => {
|
||||||
const markers = diagnostics.map(d => toDiagnostics(resource, d));
|
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);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}).then(undefined, err => {
|
}).then(undefined, err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue