fix(m9/T31): Monaco dispose editor-before-model; preserve other jsonDefaults diagnostics

This commit is contained in:
Joseph Doherty
2026-06-18 13:21:02 -04:00
parent 45ad36c115
commit af2d4037ce
@@ -314,6 +314,7 @@
} }
} }
defaults.setDiagnosticsOptions({ defaults.setDiagnosticsOptions({
...defaults.diagnosticsOptions,
validate: true, validate: true,
enableSchemaRequest: false, enableSchemaRequest: false,
schemas: schemas schemas: schemas
@@ -437,12 +438,14 @@
// a disposed json editor leaves nothing behind in the global defaults. // a disposed json editor leaves nothing behind in the global defaults.
if (entry.isJson) { if (entry.isJson) {
try { applyJsonSchema(id, null); } catch (e) {} try { applyJsonSchema(id, null); } catch (e) {}
}
try { entry.editor.dispose(); } catch (e) {}
if (entry.isJson) {
try { try {
const model = monaco.editor.getModel(modelUriFor(id)); const model = monaco.editor.getModel(modelUriFor(id));
if (model) model.dispose(); if (model) model.dispose();
} catch (e) {} } catch (e) {}
} }
try { entry.editor.dispose(); } catch (e) {}
delete editors[id]; delete editors[id];
} }