55
66import { Disposable , IDisposable , dispose } from 'vs/base/common/lifecycle' ;
77import { Emitter } from 'vs/base/common/event' ;
8- import { IWorkspaceStorageChangeEvent , IStorageService , StorageScope , IWillSaveStateEvent , WillSaveStateReason , logStorage } from 'vs/platform/storage/common/storage' ;
8+ import { IWorkspaceStorageChangeEvent , IStorageService , StorageScope , IWillSaveStateEvent , WillSaveStateReason , logStorage , IS_NEW_KEY } from 'vs/platform/storage/common/storage' ;
99import { IEnvironmentService } from 'vs/platform/environment/common/environment' ;
1010import { IWorkspaceInitializationPayload } from 'vs/platform/workspaces/common/workspaces' ;
1111import { IFileService , FileChangeType } from 'vs/platform/files/common/files' ;
@@ -20,8 +20,6 @@ export class BrowserStorageService extends Disposable implements IStorageService
2020
2121 declare readonly _serviceBrand : undefined ;
2222
23- private static readonly WORKSPACE_IS_NEW_KEY = '__$__isNewStorageMarker' ;
24-
2523 private readonly _onDidChangeStorage = this . _register ( new Emitter < IWorkspaceStorageChangeEvent > ( ) ) ;
2624 readonly onDidChangeStorage = this . _onDidChangeStorage . event ;
2725
@@ -82,12 +80,20 @@ export class BrowserStorageService extends Disposable implements IStorageService
8280 this . globalStorage . init ( )
8381 ] ) ;
8482
85- // Check to see if this is the first time we are "opening" this workspace
86- const firstOpen = this . workspaceStorage . getBoolean ( BrowserStorageService . WORKSPACE_IS_NEW_KEY ) ;
83+ // Check to see if this is the first time we are "opening" the application
84+ const firstOpen = this . globalStorage . getBoolean ( IS_NEW_KEY ) ;
8785 if ( firstOpen === undefined ) {
88- this . workspaceStorage . set ( BrowserStorageService . WORKSPACE_IS_NEW_KEY , true ) ;
86+ this . globalStorage . set ( IS_NEW_KEY , true ) ;
8987 } else if ( firstOpen ) {
90- this . workspaceStorage . set ( BrowserStorageService . WORKSPACE_IS_NEW_KEY , false ) ;
88+ this . globalStorage . set ( IS_NEW_KEY , false ) ;
89+ }
90+
91+ // Check to see if this is the first time we are "opening" this workspace
92+ const firstWorkspaceOpen = this . workspaceStorage . getBoolean ( IS_NEW_KEY ) ;
93+ if ( firstWorkspaceOpen === undefined ) {
94+ this . workspaceStorage . set ( IS_NEW_KEY , true ) ;
95+ } else if ( firstWorkspaceOpen ) {
96+ this . workspaceStorage . set ( IS_NEW_KEY , false ) ;
9197 }
9298
9399 // In the browser we do not have support for long running unload sequences. As such,
@@ -189,8 +195,8 @@ export class BrowserStorageService extends Disposable implements IStorageService
189195 this . dispose ( ) ;
190196 }
191197
192- isNew ( scope : StorageScope . WORKSPACE ) : boolean {
193- return this . getBoolean ( BrowserStorageService . WORKSPACE_IS_NEW_KEY , scope ) === true ;
198+ isNew ( scope : StorageScope ) : boolean {
199+ return this . getBoolean ( IS_NEW_KEY , scope ) === true ;
194200 }
195201
196202 dispose ( ) : void {
0 commit comments