mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-23 00:22:56 +01:00
redo diagnostics when options change, fixes #208
This commit is contained in:
parent
77b2acb257
commit
8cbd548f8e
1 changed files with 51 additions and 42 deletions
|
|
@ -74,6 +74,7 @@ export class DiagnostcsAdapter extends Adapter {
|
|||
};
|
||||
|
||||
const onModelRemoved = (model: monaco.editor.IModel): void => {
|
||||
monaco.editor.setModelMarkers(model, this._selector, []);
|
||||
const key = model.uri.toString();
|
||||
if (this._listener[key]) {
|
||||
this._listener[key].dispose();
|
||||
|
|
@ -89,13 +90,21 @@ export class DiagnostcsAdapter extends Adapter {
|
|||
}));
|
||||
|
||||
this._disposables.push({
|
||||
dispose: () => {
|
||||
for (let key in this._listener) {
|
||||
this._listener[key].dispose();
|
||||
dispose() {
|
||||
for (const model of monaco.editor.getModels()) {
|
||||
onModelRemoved(model);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this._disposables.push(this._defaults.onDidChange(() => {
|
||||
// redo diagnostics when options change
|
||||
for (const model of monaco.editor.getModels()) {
|
||||
onModelRemoved(model);
|
||||
onModelAdd(model);
|
||||
}
|
||||
}));
|
||||
|
||||
monaco.editor.getModels().forEach(onModelAdd);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue