Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/vscode.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Bierner <matb@microsoft.com>2020-05-29 07:51:14 +0300
committerMatt Bierner <matb@microsoft.com>2020-05-29 07:53:18 +0300
commit6cc7c452036528620fe9874363ed37770553c230 (patch)
treecf98cd5e5bac3dca128486299d382d8ae3277526
parentcd41dd1f6065db76c77c6e2f659bb50e6f558dec (diff)
Make sure we keep around custom editor models while autosave is going on
For #96503
-rw-r--r--src/vs/workbench/api/browser/mainThreadWebview.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/vs/workbench/api/browser/mainThreadWebview.ts b/src/vs/workbench/api/browser/mainThreadWebview.ts
index 9e4d58a2cd8..310c226e1cf 100644
--- a/src/vs/workbench/api/browser/mainThreadWebview.ts
+++ b/src/vs/workbench/api/browser/mainThreadWebview.ts
@@ -361,6 +361,17 @@ export class MainThreadWebviews extends Disposable implements extHostProtocol.Ma
}
webviewInput.webview.onDispose(() => {
+ // If the model is still dirty, make sure we have time to save it
+ if (modelRef.object.isDirty()) {
+ const sub = modelRef.object.onDidChangeDirty(() => {
+ if (!modelRef.object.isDirty()) {
+ sub.dispose();
+ modelRef.dispose();
+ }
+ });
+ return;
+ }
+
modelRef.dispose();
});