UNPKG

sussudio

Version:

An unofficial VS Code Internal API

70 lines (69 loc) 3.16 kB
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { Disposable } from "../../../base/common/lifecycle.mjs"; import { URI } from "../../../base/common/uri.mjs"; import { IConfigurationService } from "../../configuration/common/configuration.mjs"; import { ILifecycleMainService } from "../../lifecycle/electron-main/lifecycleMainService.mjs"; import { ILogService } from "../../log/common/log.mjs"; import { IStateMainService } from "../../state/electron-main/state.mjs"; import { INativeWindowConfiguration } from "../../window/common/window.mjs"; import { IWindowsMainService } from "./windows.mjs"; import { IWindowState as IWindowUIState } from "../../window/electron-main/window.mjs"; import { IWorkspaceIdentifier } from "../../workspace/common/workspace.mjs"; export interface IWindowState { readonly windowId?: number; workspace?: IWorkspaceIdentifier; folderUri?: URI; backupPath?: string; remoteAuthority?: string; uiState: IWindowUIState; } export interface IWindowsState { lastActiveWindow?: IWindowState; lastPluginDevelopmentHostWindow?: IWindowState; openedWindows: IWindowState[]; } interface INewWindowState extends IWindowUIState { hasDefaultState?: boolean; } interface ISerializedWindowsState { readonly lastActiveWindow?: ISerializedWindowState; readonly lastPluginDevelopmentHostWindow?: ISerializedWindowState; readonly openedWindows: ISerializedWindowState[]; } interface ISerializedWindowState { readonly workspaceIdentifier?: { id: string; configURIPath: string; }; readonly folder?: string; readonly backupPath?: string; readonly remoteAuthority?: string; readonly uiState: IWindowUIState; } export declare class WindowsStateHandler extends Disposable { private readonly windowsMainService; private readonly stateMainService; private readonly lifecycleMainService; private readonly logService; private readonly configurationService; private static readonly windowsStateStorageKey; get state(): IWindowsState; private readonly _state; private lastClosedState; private shuttingDown; constructor(windowsMainService: IWindowsMainService, stateMainService: IStateMainService, lifecycleMainService: ILifecycleMainService, logService: ILogService, configurationService: IConfigurationService); private registerListeners; private onBeforeShutdown; private saveWindowsState; private onBeforeCloseWindow; private toWindowState; getNewWindowState(configuration: INativeWindowConfiguration): INewWindowState; private doGetNewWindowState; private ensureNoOverlap; } export declare function restoreWindowsState(data: ISerializedWindowsState | undefined): IWindowsState; export declare function getWindowsStateStoreData(windowsState: IWindowsState): IWindowsState; export {};