Merge pull request #112 from remcohaszing/demo-dispose-old-model

Dispose the old model before switching in demo
This commit is contained in:
Remco Haszing 2021-10-02 16:15:41 +02:00 committed by GitHub
commit 4affa0963c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -152,7 +152,10 @@ fetch('https://www.schemastore.org/api/json/catalog.json').then(async (response)
});
select.addEventListener('change', () => {
ed.setModel(editor.createModel(ed.getValue(), 'yaml', Uri.parse(select.value)));
const oldModel = ed.getModel();
const newModel = editor.createModel(oldModel.getValue(), 'yaml', Uri.parse(select.value));
ed.setModel(newModel);
oldModel.dispose();
});
function* iterateSymbols(