From 3a5172aab3921498200167946156637c6c5a50cc Mon Sep 17 00:00:00 2001 From: safisa Date: Fri, 16 Sep 2022 21:55:17 +0300 Subject: [PATCH] custom-editors: fix auto save for binary custom-editors (#11599) The commit fixes the `auto save` behavior for binary custom-editors. Signed-off-by: Safi Seid-Ahmad --- .../src/main/browser/custom-editors/custom-editors-main.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/plugin-ext/src/main/browser/custom-editors/custom-editors-main.ts b/packages/plugin-ext/src/main/browser/custom-editors/custom-editors-main.ts index c223f908521b2..724d64215758a 100644 --- a/packages/plugin-ext/src/main/browser/custom-editors/custom-editors-main.ts +++ b/packages/plugin-ext/src/main/browser/custom-editors/custom-editors-main.ts @@ -25,7 +25,7 @@ import { RPCProtocol } from '../../../common/rpc-protocol'; import { HostedPluginSupport } from '../../../hosted/browser/hosted-plugin'; import { PluginCustomEditorRegistry } from './plugin-custom-editor-registry'; import { CustomEditorWidget } from './custom-editor-widget'; -import { Emitter } from '@theia/core'; +import { Emitter, UNTITLED_SCHEME } from '@theia/core'; import { UriComponents } from '../../../common/uri-components'; import { URI } from '@theia/core/shared/vscode-uri'; import TheiaURI from '@theia/core/lib/common/uri'; @@ -505,7 +505,7 @@ export class MainCustomEditorModel implements CustomEditorModel { this.onDirtyChangedEmitter.fire(); } - if (this.autoSave !== 'off') { + if (this.autoSave !== 'off' && this.dirty && this.resource.scheme !== UNTITLED_SCHEME) { const handle = window.setTimeout(() => { this.save(); window.clearTimeout(handle);