dispose saved text model with wrong view type (#209461)

This commit is contained in:
Aaron Munger 2024-04-03 11:40:33 -07:00 committed by GitHub
parent fb7f833668
commit 23860e98f0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -209,7 +209,11 @@ export class InteractiveEditorInput extends EditorInput implements ICompositeNot
return undefined; // save cancelled
}
return await this._editorModelReference.saveAs(target);
const saved = await this._editorModelReference.saveAs(target);
if (saved && 'resource' in saved && saved.resource) {
this._notebookService.getNotebookTextModel(saved.resource)?.dispose();
}
return saved;
}
override matches(otherInput: EditorInput | IUntypedEditorInput): boolean {