提交 91771ceb 编写于 作者: B Benjamin Pasero

storage2 => state

上级 63efefc7
...@@ -26,7 +26,7 @@ import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiati ...@@ -26,7 +26,7 @@ import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiati
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import { ILogService } from 'vs/platform/log/common/log'; import { ILogService } from 'vs/platform/log/common/log';
import { IStorageMainService } from 'vs/platform/storage2/common/storage'; import { IStateService } from 'vs/platform/state/common/state';
import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IURLService } from 'vs/platform/url/common/url'; import { IURLService } from 'vs/platform/url/common/url';
...@@ -76,7 +76,7 @@ export class CodeApplication { ...@@ -76,7 +76,7 @@ export class CodeApplication {
@IEnvironmentService private environmentService: IEnvironmentService, @IEnvironmentService private environmentService: IEnvironmentService,
@ILifecycleService private lifecycleService: ILifecycleService, @ILifecycleService private lifecycleService: ILifecycleService,
@IConfigurationService configurationService: ConfigurationService, @IConfigurationService configurationService: ConfigurationService,
@IStorageMainService private storageMainService: IStorageMainService, @IStateService private stateService: IStateService,
@IHistoryMainService private historyMainService: IHistoryMainService @IHistoryMainService private historyMainService: IHistoryMainService
) { ) {
this.toDispose = [mainIpcServer, configurationService]; this.toDispose = [mainIpcServer, configurationService];
...@@ -235,8 +235,8 @@ export class CodeApplication { ...@@ -235,8 +235,8 @@ export class CodeApplication {
if (event === 'vscode:changeColorTheme' && typeof payload === 'string') { if (event === 'vscode:changeColorTheme' && typeof payload === 'string') {
let data = JSON.parse(payload); let data = JSON.parse(payload);
this.storageMainService.setItem(CodeWindow.themeStorageKey, data.id); this.stateService.setItem(CodeWindow.themeStorageKey, data.id);
this.storageMainService.setItem(CodeWindow.themeBackgroundStorageKey, data.background); this.stateService.setItem(CodeWindow.themeBackgroundStorageKey, data.background);
} }
} }
...@@ -282,7 +282,7 @@ export class CodeApplication { ...@@ -282,7 +282,7 @@ export class CodeApplication {
} }
private resolveMachineId(): TPromise<string> { private resolveMachineId(): TPromise<string> {
const machineId = this.storageMainService.getItem<string>(CodeApplication.MACHINE_ID_KEY); const machineId = this.stateService.getItem<string>(CodeApplication.MACHINE_ID_KEY);
if (machineId) { if (machineId) {
return TPromise.wrap(machineId); return TPromise.wrap(machineId);
} }
...@@ -290,7 +290,7 @@ export class CodeApplication { ...@@ -290,7 +290,7 @@ export class CodeApplication {
return getMachineId().then(machineId => { return getMachineId().then(machineId => {
// Remember in global storage // Remember in global storage
this.storageMainService.setItem(CodeApplication.MACHINE_ID_KEY, machineId); this.stateService.setItem(CodeApplication.MACHINE_ID_KEY, machineId);
return machineId; return machineId;
}); });
...@@ -427,8 +427,8 @@ export class CodeApplication { ...@@ -427,8 +427,8 @@ export class CodeApplication {
// Helps application icon refresh after an update with new icon is installed (macOS) // Helps application icon refresh after an update with new icon is installed (macOS)
// TODO@Ben remove after a couple of releases // TODO@Ben remove after a couple of releases
if (platform.isMacintosh) { if (platform.isMacintosh) {
if (!this.storageMainService.getItem(CodeApplication.APP_ICON_REFRESH_KEY)) { if (!this.stateService.getItem(CodeApplication.APP_ICON_REFRESH_KEY)) {
this.storageMainService.setItem(CodeApplication.APP_ICON_REFRESH_KEY, true); this.stateService.setItem(CodeApplication.APP_ICON_REFRESH_KEY, true);
// 'exe' => /Applications/Visual Studio Code - Insiders.app/Contents/MacOS/Electron // 'exe' => /Applications/Visual Studio Code - Insiders.app/Contents/MacOS/Electron
const appPath = dirname(dirname(dirname(app.getPath('exe')))); const appPath = dirname(dirname(dirname(app.getPath('exe'))));
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
import * as nativeKeymap from 'native-keymap'; import * as nativeKeymap from 'native-keymap';
import { IDisposable } from 'vs/base/common/lifecycle'; import { IDisposable } from 'vs/base/common/lifecycle';
import { IStorageMainService } from 'vs/platform/storage2/common/storage'; import { IStateService } from 'vs/platform/state/common/state';
import Event, { Emitter, once } from 'vs/base/common/event'; import Event, { Emitter, once } from 'vs/base/common/event';
import { ConfigWatcher } from 'vs/base/node/config'; import { ConfigWatcher } from 'vs/base/node/config';
import { IUserFriendlyKeybinding } from 'vs/platform/keybinding/common/keybinding'; import { IUserFriendlyKeybinding } from 'vs/platform/keybinding/common/keybinding';
...@@ -58,13 +58,13 @@ export class KeybindingsResolver { ...@@ -58,13 +58,13 @@ export class KeybindingsResolver {
onKeybindingsChanged: Event<void> = this._onKeybindingsChanged.event; onKeybindingsChanged: Event<void> = this._onKeybindingsChanged.event;
constructor( constructor(
@IStorageMainService private storageMainService: IStorageMainService, @IStateService private stateService: IStateService,
@IEnvironmentService environmentService: IEnvironmentService, @IEnvironmentService environmentService: IEnvironmentService,
@IWindowsMainService private windowsMainService: IWindowsMainService, @IWindowsMainService private windowsMainService: IWindowsMainService,
@ILogService private logService: ILogService @ILogService private logService: ILogService
) { ) {
this.commandIds = new Set<string>(); this.commandIds = new Set<string>();
this.keybindings = this.storageMainService.getItem<{ [id: string]: string; }>(KeybindingsResolver.lastKnownKeybindingsMapStorageKey) || Object.create(null); this.keybindings = this.stateService.getItem<{ [id: string]: string; }>(KeybindingsResolver.lastKnownKeybindingsMapStorageKey) || Object.create(null);
this.keybindingsWatcher = new ConfigWatcher<IUserFriendlyKeybinding[]>(environmentService.appKeybindingsPath, { changeBufferDelay: 100, onError: error => this.logService.error(error) }); this.keybindingsWatcher = new ConfigWatcher<IUserFriendlyKeybinding[]>(environmentService.appKeybindingsPath, { changeBufferDelay: 100, onError: error => this.logService.error(error) });
this.registerListeners(); this.registerListeners();
...@@ -102,7 +102,7 @@ export class KeybindingsResolver { ...@@ -102,7 +102,7 @@ export class KeybindingsResolver {
if (keybindingsChanged) { if (keybindingsChanged) {
this.keybindings = resolvedKeybindings; this.keybindings = resolvedKeybindings;
this.storageMainService.setItem(KeybindingsResolver.lastKnownKeybindingsMapStorageKey, this.keybindings); // keep to restore instantly after restart this.stateService.setItem(KeybindingsResolver.lastKnownKeybindingsMapStorageKey, this.keybindings); // keep to restore instantly after restart
this._onKeybindingsChanged.fire(); this._onKeybindingsChanged.fire();
} }
......
...@@ -21,8 +21,8 @@ import { InstantiationService } from 'vs/platform/instantiation/common/instantia ...@@ -21,8 +21,8 @@ import { InstantiationService } from 'vs/platform/instantiation/common/instantia
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import { ILogService, LogMainService } from 'vs/platform/log/common/log'; import { ILogService, LogMainService } from 'vs/platform/log/common/log';
import { StorageMainService } from 'vs/platform/storage2/node/storageMainService'; import { StateService } from 'vs/platform/state/node/stateService';
import { IStorageMainService } from 'vs/platform/storage2/common/storage'; import { IStateService } from 'vs/platform/state/common/state';
import { IBackupMainService } from 'vs/platform/backup/common/backup'; import { IBackupMainService } from 'vs/platform/backup/common/backup';
import { BackupMainService } from 'vs/platform/backup/electron-main/backupMainService'; import { BackupMainService } from 'vs/platform/backup/electron-main/backupMainService';
import { IEnvironmentService, ParsedArgs } from 'vs/platform/environment/common/environment'; import { IEnvironmentService, ParsedArgs } from 'vs/platform/environment/common/environment';
...@@ -50,7 +50,7 @@ function createServices(args: ParsedArgs): IInstantiationService { ...@@ -50,7 +50,7 @@ function createServices(args: ParsedArgs): IInstantiationService {
services.set(IWorkspacesMainService, new SyncDescriptor(WorkspacesMainService)); services.set(IWorkspacesMainService, new SyncDescriptor(WorkspacesMainService));
services.set(IHistoryMainService, new SyncDescriptor(HistoryMainService)); services.set(IHistoryMainService, new SyncDescriptor(HistoryMainService));
services.set(ILifecycleService, new SyncDescriptor(LifecycleService)); services.set(ILifecycleService, new SyncDescriptor(LifecycleService));
services.set(IStorageMainService, new SyncDescriptor(StorageMainService)); services.set(IStateService, new SyncDescriptor(StateService));
services.set(IConfigurationService, new SyncDescriptor(ConfigurationService)); services.set(IConfigurationService, new SyncDescriptor(ConfigurationService));
services.set(IRequestService, new SyncDescriptor(RequestService)); services.set(IRequestService, new SyncDescriptor(RequestService));
services.set(IURLService, new SyncDescriptor(URLService, args['open-url'])); services.set(IURLService, new SyncDescriptor(URLService, args['open-url']));
......
...@@ -9,7 +9,7 @@ import * as path from 'path'; ...@@ -9,7 +9,7 @@ import * as path from 'path';
import * as objects from 'vs/base/common/objects'; import * as objects from 'vs/base/common/objects';
import nls = require('vs/nls'); import nls = require('vs/nls');
import URI from 'vs/base/common/uri'; import URI from 'vs/base/common/uri';
import { IStorageMainService } from 'vs/platform/storage2/common/storage'; import { IStateService } from 'vs/platform/state/common/state';
import { shell, screen, BrowserWindow, systemPreferences, app, TouchBar, nativeImage } from 'electron'; import { shell, screen, BrowserWindow, systemPreferences, app, TouchBar, nativeImage } from 'electron';
import { TPromise, TValueCallback } from 'vs/base/common/winjs.base'; import { TPromise, TValueCallback } from 'vs/base/common/winjs.base';
import { IEnvironmentService, ParsedArgs } from 'vs/platform/environment/common/environment'; import { IEnvironmentService, ParsedArgs } from 'vs/platform/environment/common/environment';
...@@ -104,7 +104,7 @@ export class CodeWindow implements ICodeWindow { ...@@ -104,7 +104,7 @@ export class CodeWindow implements ICodeWindow {
@ILogService private logService: ILogService, @ILogService private logService: ILogService,
@IEnvironmentService private environmentService: IEnvironmentService, @IEnvironmentService private environmentService: IEnvironmentService,
@IConfigurationService private configurationService: IConfigurationService, @IConfigurationService private configurationService: IConfigurationService,
@IStorageMainService private storageMainService: IStorageMainService, @IStateService private stateService: IStateService,
@IWorkspacesMainService private workspacesMainService: IWorkspacesMainService, @IWorkspacesMainService private workspacesMainService: IWorkspacesMainService,
@IBackupMainService private backupMainService: IBackupMainService @IBackupMainService private backupMainService: IBackupMainService
) { ) {
...@@ -595,7 +595,7 @@ export class CodeWindow implements ICodeWindow { ...@@ -595,7 +595,7 @@ export class CodeWindow implements ICodeWindow {
return 'hc-black'; return 'hc-black';
} }
const theme = this.storageMainService.getItem<string>(CodeWindow.themeStorageKey, 'vs-dark'); const theme = this.stateService.getItem<string>(CodeWindow.themeStorageKey, 'vs-dark');
return theme.split(' ')[0]; return theme.split(' ')[0];
} }
...@@ -605,7 +605,7 @@ export class CodeWindow implements ICodeWindow { ...@@ -605,7 +605,7 @@ export class CodeWindow implements ICodeWindow {
return CodeWindow.DEFAULT_BG_HC_BLACK; return CodeWindow.DEFAULT_BG_HC_BLACK;
} }
const background = this.storageMainService.getItem<string>(CodeWindow.themeBackgroundStorageKey, null); const background = this.stateService.getItem<string>(CodeWindow.themeBackgroundStorageKey, null);
if (!background) { if (!background) {
const baseTheme = this.getBaseTheme(); const baseTheme = this.getBaseTheme();
......
...@@ -12,7 +12,7 @@ import * as arrays from 'vs/base/common/arrays'; ...@@ -12,7 +12,7 @@ import * as arrays from 'vs/base/common/arrays';
import { assign, mixin, equals } from 'vs/base/common/objects'; import { assign, mixin, equals } from 'vs/base/common/objects';
import { IBackupMainService } from 'vs/platform/backup/common/backup'; import { IBackupMainService } from 'vs/platform/backup/common/backup';
import { IEnvironmentService, ParsedArgs } from 'vs/platform/environment/common/environment'; import { IEnvironmentService, ParsedArgs } from 'vs/platform/environment/common/environment';
import { IStorageMainService } from 'vs/platform/storage2/common/storage'; import { IStateService } from 'vs/platform/state/common/state';
import { CodeWindow, IWindowState as ISingleWindowState, defaultWindowState, WindowMode } from 'vs/code/electron-main/window'; import { CodeWindow, IWindowState as ISingleWindowState, defaultWindowState, WindowMode } from 'vs/code/electron-main/window';
import { ipcMain as ipc, screen, BrowserWindow, dialog, systemPreferences, app } from 'electron'; import { ipcMain as ipc, screen, BrowserWindow, dialog, systemPreferences, app } from 'electron';
import { IPathWithLineAndColumn, parseLineAndColumnAware } from 'vs/code/node/paths'; import { IPathWithLineAndColumn, parseLineAndColumnAware } from 'vs/code/node/paths';
...@@ -140,7 +140,7 @@ export class WindowsManager implements IWindowsMainService { ...@@ -140,7 +140,7 @@ export class WindowsManager implements IWindowsMainService {
constructor( constructor(
private readonly machineId: string, private readonly machineId: string,
@ILogService private logService: ILogService, @ILogService private logService: ILogService,
@IStorageMainService private storageMainService: IStorageMainService, @IStateService private stateService: IStateService,
@IEnvironmentService private environmentService: IEnvironmentService, @IEnvironmentService private environmentService: IEnvironmentService,
@ILifecycleService private lifecycleService: ILifecycleService, @ILifecycleService private lifecycleService: ILifecycleService,
@IBackupMainService private backupMainService: IBackupMainService, @IBackupMainService private backupMainService: IBackupMainService,
...@@ -150,9 +150,9 @@ export class WindowsManager implements IWindowsMainService { ...@@ -150,9 +150,9 @@ export class WindowsManager implements IWindowsMainService {
@IWorkspacesMainService private workspacesMainService: IWorkspacesMainService, @IWorkspacesMainService private workspacesMainService: IWorkspacesMainService,
@IInstantiationService private instantiationService: IInstantiationService @IInstantiationService private instantiationService: IInstantiationService
) { ) {
this.windowsState = this.storageMainService.getItem<IWindowsState>(WindowsManager.windowsStateStorageKey) || { openedWindows: [] }; this.windowsState = this.stateService.getItem<IWindowsState>(WindowsManager.windowsStateStorageKey) || { openedWindows: [] };
this.fileDialog = new FileDialog(environmentService, telemetryService, storageMainService, this); this.fileDialog = new FileDialog(environmentService, telemetryService, stateService, this);
this.workspacesManager = new WorkspacesManager(workspacesMainService, backupMainService, environmentService, this); this.workspacesManager = new WorkspacesManager(workspacesMainService, backupMainService, environmentService, this);
this.migrateLegacyWindowState(); this.migrateLegacyWindowState();
...@@ -311,7 +311,7 @@ export class WindowsManager implements IWindowsMainService { ...@@ -311,7 +311,7 @@ export class WindowsManager implements IWindowsMainService {
} }
// Persist // Persist
this.storageMainService.setItem(WindowsManager.windowsStateStorageKey, currentWindowsState); this.stateService.setItem(WindowsManager.windowsStateStorageKey, currentWindowsState);
} }
// See note on #onBeforeQuit() for details how these events are flowing // See note on #onBeforeQuit() for details how these events are flowing
...@@ -1589,7 +1589,7 @@ class FileDialog { ...@@ -1589,7 +1589,7 @@ class FileDialog {
constructor( constructor(
private environmentService: IEnvironmentService, private environmentService: IEnvironmentService,
private telemetryService: ITelemetryService, private telemetryService: ITelemetryService,
private storageMainService: IStorageMainService, private stateService: IStateService,
private windowsMainService: IWindowsMainService private windowsMainService: IWindowsMainService
) { ) {
} }
...@@ -1630,7 +1630,7 @@ class FileDialog { ...@@ -1630,7 +1630,7 @@ class FileDialog {
// Ensure defaultPath // Ensure defaultPath
if (!options.dialogOptions.defaultPath) { if (!options.dialogOptions.defaultPath) {
options.dialogOptions.defaultPath = this.storageMainService.getItem<string>(FileDialog.workingDirPickerStorageKey); options.dialogOptions.defaultPath = this.stateService.getItem<string>(FileDialog.workingDirPickerStorageKey);
} }
// Ensure properties // Ensure properties
...@@ -1659,7 +1659,7 @@ class FileDialog { ...@@ -1659,7 +1659,7 @@ class FileDialog {
} }
// Remember path in storage for next time // Remember path in storage for next time
this.storageMainService.setItem(FileDialog.workingDirPickerStorageKey, dirname(paths[0])); this.stateService.setItem(FileDialog.workingDirPickerStorageKey, dirname(paths[0]));
// Return // Return
return clb(paths); return clb(paths);
......
...@@ -9,7 +9,7 @@ import * as path from 'path'; ...@@ -9,7 +9,7 @@ import * as path from 'path';
import * as nls from 'vs/nls'; import * as nls from 'vs/nls';
import * as arrays from 'vs/base/common/arrays'; import * as arrays from 'vs/base/common/arrays';
import { trim } from 'vs/base/common/strings'; import { trim } from 'vs/base/common/strings';
import { IStorageMainService } from 'vs/platform/storage2/common/storage'; import { IStateService } from 'vs/platform/state/common/state';
import { app } from 'electron'; import { app } from 'electron';
import { ILogService } from 'vs/platform/log/common/log'; import { ILogService } from 'vs/platform/log/common/log';
import { getPathLabel, getBaseLabel } from 'vs/base/common/labels'; import { getPathLabel, getBaseLabel } from 'vs/base/common/labels';
...@@ -41,7 +41,7 @@ export class HistoryMainService implements IHistoryMainService { ...@@ -41,7 +41,7 @@ export class HistoryMainService implements IHistoryMainService {
private macOSRecentDocumentsUpdater: RunOnceScheduler; private macOSRecentDocumentsUpdater: RunOnceScheduler;
constructor( constructor(
@IStorageMainService private storageMainService: IStorageMainService, @IStateService private stateService: IStateService,
@ILogService private logService: ILogService, @ILogService private logService: ILogService,
@IWorkspacesMainService private workspacesMainService: IWorkspacesMainService, @IWorkspacesMainService private workspacesMainService: IWorkspacesMainService,
@IEnvironmentService private environmentService: IEnvironmentService, @IEnvironmentService private environmentService: IEnvironmentService,
...@@ -179,7 +179,7 @@ export class HistoryMainService implements IHistoryMainService { ...@@ -179,7 +179,7 @@ export class HistoryMainService implements IHistoryMainService {
let files: string[]; let files: string[];
// Get from storage // Get from storage
const storedRecents = this.storageMainService.getItem<IRecentlyOpened>(HistoryMainService.recentlyOpenedStorageKey) as ILegacyRecentlyOpened; const storedRecents = this.stateService.getItem<IRecentlyOpened>(HistoryMainService.recentlyOpenedStorageKey) as ILegacyRecentlyOpened;
if (storedRecents) { if (storedRecents) {
workspaces = storedRecents.workspaces || storedRecents.folders || []; workspaces = storedRecents.workspaces || storedRecents.folders || [];
files = storedRecents.files || []; files = storedRecents.files || [];
...@@ -217,7 +217,7 @@ export class HistoryMainService implements IHistoryMainService { ...@@ -217,7 +217,7 @@ export class HistoryMainService implements IHistoryMainService {
} }
private saveRecentlyOpened(recent: IRecentlyOpened): void { private saveRecentlyOpened(recent: IRecentlyOpened): void {
this.storageMainService.setItem(HistoryMainService.recentlyOpenedStorageKey, recent); this.stateService.setItem(HistoryMainService.recentlyOpenedStorageKey, recent);
} }
public updateWindowsJumpList(): void { public updateWindowsJumpList(): void {
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
import { ipcMain as ipc, app } from 'electron'; import { ipcMain as ipc, app } from 'electron';
import { TPromise, TValueCallback } from 'vs/base/common/winjs.base'; import { TPromise, TValueCallback } from 'vs/base/common/winjs.base';
import { ILogService } from 'vs/platform/log/common/log'; import { ILogService } from 'vs/platform/log/common/log';
import { IStorageMainService } from 'vs/platform/storage2/common/storage'; import { IStateService } from 'vs/platform/state/common/state';
import Event, { Emitter } from 'vs/base/common/event'; import Event, { Emitter } from 'vs/base/common/event';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { ICodeWindow } from 'vs/platform/windows/electron-main/windows'; import { ICodeWindow } from 'vs/platform/windows/electron-main/windows';
...@@ -94,7 +94,7 @@ export class LifecycleService implements ILifecycleService { ...@@ -94,7 +94,7 @@ export class LifecycleService implements ILifecycleService {
constructor( constructor(
@ILogService private logService: ILogService, @ILogService private logService: ILogService,
@IStorageMainService private storageMainService: IStorageMainService @IStateService private stateService: IStateService
) { ) {
this.windowToCloseRequest = Object.create(null); this.windowToCloseRequest = Object.create(null);
this.quitRequested = false; this.quitRequested = false;
...@@ -105,10 +105,10 @@ export class LifecycleService implements ILifecycleService { ...@@ -105,10 +105,10 @@ export class LifecycleService implements ILifecycleService {
} }
private handleRestarted(): void { private handleRestarted(): void {
this._wasRestarted = !!this.storageMainService.getItem(LifecycleService.QUIT_FROM_RESTART_MARKER); this._wasRestarted = !!this.stateService.getItem(LifecycleService.QUIT_FROM_RESTART_MARKER);
if (this._wasRestarted) { if (this._wasRestarted) {
this.storageMainService.removeItem(LifecycleService.QUIT_FROM_RESTART_MARKER); // remove the marker right after if found this.stateService.removeItem(LifecycleService.QUIT_FROM_RESTART_MARKER); // remove the marker right after if found
} }
} }
...@@ -258,7 +258,7 @@ export class LifecycleService implements ILifecycleService { ...@@ -258,7 +258,7 @@ export class LifecycleService implements ILifecycleService {
app.once('will-quit', () => { app.once('will-quit', () => {
if (this.pendingQuitPromiseComplete) { if (this.pendingQuitPromiseComplete) {
if (fromUpdate) { if (fromUpdate) {
this.storageMainService.setItem(LifecycleService.QUIT_FROM_RESTART_MARKER, true); this.stateService.setItem(LifecycleService.QUIT_FROM_RESTART_MARKER, true);
} }
this.pendingQuitPromiseComplete(false /* no veto */); this.pendingQuitPromiseComplete(false /* no veto */);
...@@ -296,7 +296,7 @@ export class LifecycleService implements ILifecycleService { ...@@ -296,7 +296,7 @@ export class LifecycleService implements ILifecycleService {
let vetoed = false; let vetoed = false;
app.once('quit', () => { app.once('quit', () => {
if (!vetoed) { if (!vetoed) {
this.storageMainService.setItem(LifecycleService.QUIT_FROM_RESTART_MARKER, true); this.stateService.setItem(LifecycleService.QUIT_FROM_RESTART_MARKER, true);
app.relaunch({ args }); app.relaunch({ args });
} }
}); });
......
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
export const IStorageMainService = createDecorator<IStorageMainService>('storageMainService'); export const IStateService = createDecorator<IStateService>('stateService');
export interface IStorageMainService { export interface IStateService {
_serviceBrand: any; _serviceBrand: any;
getItem<T>(key: string, defaultValue?: T): T; getItem<T>(key: string, defaultValue?: T): T;
......
...@@ -10,7 +10,7 @@ import * as fs from 'original-fs'; ...@@ -10,7 +10,7 @@ import * as fs from 'original-fs';
import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { writeFileAndFlushSync } from 'vs/base/node/extfs'; import { writeFileAndFlushSync } from 'vs/base/node/extfs';
import { isUndefined, isUndefinedOrNull } from 'vs/base/common/types'; import { isUndefined, isUndefinedOrNull } from 'vs/base/common/types';
import { IStorageMainService } from 'vs/platform/storage2/common/storage'; import { IStateService } from 'vs/platform/state/common/state';
export class FileStorage { export class FileStorage {
...@@ -87,7 +87,7 @@ export class FileStorage { ...@@ -87,7 +87,7 @@ export class FileStorage {
} }
} }
export class StorageMainService implements IStorageMainService { export class StateService implements IStateService {
_serviceBrand: any; _serviceBrand: any;
......
...@@ -11,10 +11,10 @@ import path = require('path'); ...@@ -11,10 +11,10 @@ import path = require('path');
import extfs = require('vs/base/node/extfs'); import extfs = require('vs/base/node/extfs');
import { getRandomTestPath } from 'vs/workbench/test/workbenchTestServices'; import { getRandomTestPath } from 'vs/workbench/test/workbenchTestServices';
import { writeFileAndFlushSync, mkdirp } from 'vs/base/node/extfs'; import { writeFileAndFlushSync, mkdirp } from 'vs/base/node/extfs';
import { FileStorage } from 'vs/platform/storage2/node/storageMainService'; import { FileStorage } from 'vs/platform/state/node/stateService';
suite('StorageMainService', () => { suite('StateService', () => {
const parentDir = getRandomTestPath(os.tmpdir(), 'vsctests', 'storageservice'); const parentDir = getRandomTestPath(os.tmpdir(), 'vsctests', 'stateservice');
const storageFile = path.join(parentDir, 'storage.json'); const storageFile = path.join(parentDir, 'storage.json');
teardown(done => { teardown(done => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册