From 88bc7d781362db766d979e5b16836ff4bbad4451 Mon Sep 17 00:00:00 2001 From: Vlad Arama Date: Thu, 8 Jun 2023 08:45:25 -0400 Subject: [PATCH] workspace: modifying retrieval of untitled files --- .../browser/common-frontend-contribution.ts | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/core/src/browser/common-frontend-contribution.ts b/packages/core/src/browser/common-frontend-contribution.ts index 9277d6bc7abc1..adb269304c741 100644 --- a/packages/core/src/browser/common-frontend-contribution.ts +++ b/packages/core/src/browser/common-frontend-contribution.ts @@ -36,7 +36,7 @@ import { OS, isOSX, isWindows } from '../common/os'; import { ResourceContextKey } from './resource-context-key'; import { UriSelection } from '../common/selection'; import { StorageService } from './storage-service'; -import { Navigatable } from './navigatable'; +import { Navigatable, NavigatableWidget } from './navigatable'; import { QuickViewService } from './quick-input/quick-view-service'; import { environment } from '@theia/application-package/lib/environment'; import { IconTheme, IconThemeService } from './icon-theme-service'; @@ -63,7 +63,7 @@ import { DecorationStyle } from './decoration-style'; import { isPinned, Title, togglePinned, Widget } from './widgets'; import { SaveResourceService } from './save-resource-service'; import { UserWorkingDirectoryProvider } from './user-working-directory-provider'; -import { UntitledResourceResolver } from '../common'; +import { UNTITLED_SCHEME, UntitledResourceResolver } from '../common'; import { LanguageQuickPickService } from './i18n/language-quick-pick-service'; export namespace CommonMenus { @@ -1150,13 +1150,13 @@ export class CommonFrontendContribution implements FrontendApplicationContributi const captionsToSave = this.unsavedTabsCaptions(); const untitledCaptionsToSave = this.unsavedUntitledTabsCaptions(); const result = await confirmExitWithOrWithoutSaving(captionsToSave, async () => { - await this.shell.saveAll(); - await this.saveDirty(untitledCaptionsToSave); - }); - return result; - } - }; - } + await this.shell.saveAll(); + await this.saveDirty(untitledCaptionsToSave); + }); + return result; + } + }; + } } finally { this.shouldPreventClose = false; } @@ -1168,7 +1168,7 @@ export class CommonFrontendContribution implements FrontendApplicationContributi } protected unsavedUntitledTabsCaptions(): Widget[] { return this.shell.widgets.filter(widget => - widget.title.label.includes('Untitled-') && this.saveResourceService.canSaveAs(widget) + NavigatableWidget.getUri(widget)?.scheme === UNTITLED_SCHEME && this.saveResourceService.canSaveAs(widget) ); } protected async configureDisplayLanguage(): Promise {