提交 b434afd9 编写于 作者: B Benjamin Pasero

storage - add workbench.enableLegacyStorage setting as emergency in case new...

storage - add workbench.enableLegacyStorage setting as emergency in case new solution fails for someone
上级 8adb061a
...@@ -17,6 +17,7 @@ import { localize } from 'vs/nls'; ...@@ -17,6 +17,7 @@ import { localize } from 'vs/nls';
import { mark, getDuration } from 'vs/base/common/performance'; import { mark, getDuration } from 'vs/base/common/performance';
import { join, basename } from 'path'; import { join, basename } from 'path';
import { copy } from 'vs/base/node/pfs'; import { copy } from 'vs/base/node/pfs';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
export class StorageService extends Disposable implements IStorageService { export class StorageService extends Disposable implements IStorageService {
_serviceBrand: any; _serviceBrand: any;
...@@ -273,14 +274,18 @@ export class DelegatingStorageService extends Disposable implements IStorageServ ...@@ -273,14 +274,18 @@ export class DelegatingStorageService extends Disposable implements IStorageServ
get onWillSaveState(): Event<void> { return this._onWillSaveState.event; } get onWillSaveState(): Event<void> { return this._onWillSaveState.event; }
private closed: boolean; private closed: boolean;
private useLegacyWorkspaceStorage: boolean;
constructor( constructor(
private storageService: IStorageService, private storageService: IStorageService,
private storageLegacyService: IStorageLegacyService, private storageLegacyService: IStorageLegacyService,
private logService: ILogService private logService: ILogService,
configurationService: IConfigurationService
) { ) {
super(); super();
this.useLegacyWorkspaceStorage = configurationService.inspect<boolean>('workbench.enableLegacyStorage').value === true;
this.registerListeners(); this.registerListeners();
} }
...@@ -304,7 +309,7 @@ export class DelegatingStorageService extends Disposable implements IStorageServ ...@@ -304,7 +309,7 @@ export class DelegatingStorageService extends Disposable implements IStorageServ
} }
get(key: string, scope: StorageScope, fallbackValue?: string): string { get(key: string, scope: StorageScope, fallbackValue?: string): string {
if (scope === StorageScope.WORKSPACE) { if (scope === StorageScope.WORKSPACE && !this.useLegacyWorkspaceStorage) {
return this.storageService.get(key, scope, fallbackValue); return this.storageService.get(key, scope, fallbackValue);
} }
...@@ -312,7 +317,7 @@ export class DelegatingStorageService extends Disposable implements IStorageServ ...@@ -312,7 +317,7 @@ export class DelegatingStorageService extends Disposable implements IStorageServ
} }
getBoolean(key: string, scope: StorageScope, fallbackValue?: boolean): boolean { getBoolean(key: string, scope: StorageScope, fallbackValue?: boolean): boolean {
if (scope === StorageScope.WORKSPACE) { if (scope === StorageScope.WORKSPACE && !this.useLegacyWorkspaceStorage) {
return this.storageService.getBoolean(key, scope, fallbackValue); return this.storageService.getBoolean(key, scope, fallbackValue);
} }
...@@ -320,7 +325,7 @@ export class DelegatingStorageService extends Disposable implements IStorageServ ...@@ -320,7 +325,7 @@ export class DelegatingStorageService extends Disposable implements IStorageServ
} }
getInteger(key: string, scope: StorageScope, fallbackValue?: number): number { getInteger(key: string, scope: StorageScope, fallbackValue?: number): number {
if (scope === StorageScope.WORKSPACE) { if (scope === StorageScope.WORKSPACE && !this.useLegacyWorkspaceStorage) {
return this.storageService.getInteger(key, scope, fallbackValue); return this.storageService.getInteger(key, scope, fallbackValue);
} }
......
...@@ -677,6 +677,12 @@ configurationRegistry.registerConfiguration({ ...@@ -677,6 +677,12 @@ configurationRegistry.registerConfiguration({
'description': nls.localize('workbench.enableExperiments', "Fetches experiments to run from a Microsoft online service."), 'description': nls.localize('workbench.enableExperiments', "Fetches experiments to run from a Microsoft online service."),
'default': true, 'default': true,
'tags': ['usesOnlineServices'] 'tags': ['usesOnlineServices']
},
//TODO@Ben remove ('enableLegacyStorage') after a while
'workbench.enableLegacyStorage': {
'type': 'boolean',
'description': nls.localize('workbench.enableLegacyStorage', "Switches back to the previous storage implementation. Only change this setting if advised to do so."),
'default': false
} }
} }
}); });
......
...@@ -123,7 +123,7 @@ function openWorkbench(configuration: IWindowConfiguration): Promise<void> { ...@@ -123,7 +123,7 @@ function openWorkbench(configuration: IWindowConfiguration): Promise<void> {
createStorageService(workspaceStoragePath, payload, environmentService, logService) createStorageService(workspaceStoragePath, payload, environmentService, logService)
]).then(services => { ]).then(services => {
const workspaceService = services[0]; const workspaceService = services[0];
const storageService = new DelegatingStorageService(services[1], createStorageLegacyService(workspaceService, environmentService), logService); const storageService = new DelegatingStorageService(services[1], createStorageLegacyService(workspaceService, environmentService), logService, workspaceService);
return domContentLoaded().then(() => { return domContentLoaded().then(() => {
perf.mark('willStartWorkbench'); perf.mark('willStartWorkbench');
......
...@@ -24,7 +24,7 @@ interface IConfiguration extends IWindowsConfiguration { ...@@ -24,7 +24,7 @@ interface IConfiguration extends IWindowsConfiguration {
update: { channel: string; }; update: { channel: string; };
telemetry: { enableCrashReporter: boolean }; telemetry: { enableCrashReporter: boolean };
keyboard: { touchbar: { enabled: boolean } }; keyboard: { touchbar: { enabled: boolean } };
workbench: { tree: { horizontalScrolling: boolean } }; workbench: { tree: { horizontalScrolling: boolean }, enableLegacyStorage: boolean };
files: { useExperimentalFileWatcher: boolean, watcherExclude: object }; files: { useExperimentalFileWatcher: boolean, watcherExclude: object };
} }
...@@ -40,6 +40,7 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo ...@@ -40,6 +40,7 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo
private treeHorizontalScrolling: boolean; private treeHorizontalScrolling: boolean;
private experimentalFileWatcher: boolean; private experimentalFileWatcher: boolean;
private fileWatcherExclude: object; private fileWatcherExclude: object;
private legacyStorage: boolean;
private firstFolderResource: URI; private firstFolderResource: URI;
private extensionHostRestarter: RunOnceScheduler; private extensionHostRestarter: RunOnceScheduler;
...@@ -137,6 +138,12 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo ...@@ -137,6 +138,12 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo
changed = true; changed = true;
} }
// Legacy Workspace Storage
if (config.workbench && typeof config.workbench.enableLegacyStorage === 'boolean' && config.workbench.enableLegacyStorage !== this.legacyStorage) {
this.legacyStorage = config.workbench.enableLegacyStorage;
changed = true;
}
// Notify only when changed and we are the focused window (avoids notification spam across windows) // Notify only when changed and we are the focused window (avoids notification spam across windows)
if (notify && changed) { if (notify && changed) {
this.doConfirm( this.doConfirm(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册