Trigger an event when the extra libs changed, redoing all colorization and diagnostics

This commit is contained in:
placatus 2019-02-22 15:16:21 +02:00
parent e39fa719bc
commit 357f54c652
2 changed files with 12 additions and 3 deletions

View file

@ -134,14 +134,15 @@ export class DiagnostcsAdapter extends Adapter {
}
}
});
this._disposables.push(this._defaults.onDidChange(() => {
let redoDiagosticsCallback = () => {
// redo diagnostics when options change
for (const model of monaco.editor.getModels()) {
onModelRemoved(model);
onModelAdd(model);
}
}));
};
this._disposables.push(this._defaults.onDidChange(redoDiagosticsCallback));
this._disposables.push(this._defaults.onDidExtraLibsChange(redoDiagosticsCallback));
monaco.editor.getModels().forEach(onModelAdd);
}