From 906b111e3fc7bf2bdffa13ba31214715d37d908a Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Tue, 17 Dec 2019 16:46:19 -0800 Subject: [PATCH] Only fire is dirty event for custom editor when the editor model is actually dirty Fixes #86551 Firing isDirty causes the editor to become pinned. We don't want this to happen by if no edits have happened --- .../contrib/customEditor/browser/customEditorInput.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts b/src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts index 316fffe4b4f0..483d0490e385 100644 --- a/src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts +++ b/src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts @@ -143,7 +143,9 @@ export class CustomFileEditorInput extends LazilyResolvedWebviewEditorInput { public async resolve(): Promise { this._model = await this.customEditorService.models.loadOrCreate(this.getResource(), this.viewType); this._register(this._model.onDidChangeDirty(() => this._onDidChangeDirty.fire())); - this._onDidChangeDirty.fire(); + if (this.isDirty()) { + this._onDidChangeDirty.fire(); + } return await super.resolve(); }