sussudio
Version:
An unofficial VS Code Internal API
163 lines (162 loc) • 8.4 kB
text/typescript
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { BrowserWindow, Rectangle } from 'electron';
import { CancellationToken } from "../../../base/common/cancellation.mjs";
import { Disposable } from "../../../base/common/lifecycle.mjs";
import { ISerializableCommandAction } from "../../action/common/action.mjs";
import { IBackupMainService } from "../../backup/electron-main/backup.mjs";
import { IConfigurationService } from "../../configuration/common/configuration.mjs";
import { IDialogMainService } from "../../dialogs/electron-main/dialogMainService.mjs";
import { NativeParsedArgs } from "../../environment/common/argv.mjs";
import { IEnvironmentMainService } from "../../environment/electron-main/environmentMainService.mjs";
import { IFileService } from "../../files/common/files.mjs";
import { ILifecycleMainService } from "../../lifecycle/electron-main/lifecycleMainService.mjs";
import { ILogService } from "../../log/common/log.mjs";
import { IProductService } from "../../product/common/productService.mjs";
import { IProtocolMainService } from "../../protocol/electron-main/protocol.mjs";
import { IApplicationStorageMainService, IStorageMainService } from "../../storage/electron-main/storageMainService.mjs";
import { ITelemetryService } from "../../telemetry/common/telemetry.mjs";
import { IThemeMainService } from "../../theme/electron-main/themeMainService.mjs";
import { INativeWindowConfiguration } from "../../window/common/window.mjs";
import { IWindowsMainService } from "./windows.mjs";
import { ISingleFolderWorkspaceIdentifier, IWorkspaceIdentifier } from "../../workspace/common/workspace.mjs";
import { IWorkspacesManagementMainService } from "../../workspaces/electron-main/workspacesManagementMainService.mjs";
import { IWindowState, ICodeWindow, ILoadEvent } from "../../window/electron-main/window.mjs";
import { IPolicyService } from "../../policy/common/policy.mjs";
import { IUserDataProfile } from "../../userDataProfile/common/userDataProfile.mjs";
import { IStateMainService } from "../../state/electron-main/state.mjs";
import { IUserDataProfilesMainService } from "../../userDataProfile/electron-main/userDataProfile.mjs";
import { INativeHostMainService } from "../../native/electron-main/nativeHostMainService.mjs";
export interface IWindowCreationOptions {
readonly state: IWindowState;
readonly extensionDevelopmentPath?: string[];
readonly isExtensionTestHost?: boolean;
}
interface ILoadOptions {
readonly isReload?: boolean;
readonly disableExtensions?: boolean;
}
export declare class CodeWindow extends Disposable implements ICodeWindow {
private readonly logService;
private readonly environmentMainService;
private readonly policyService;
private readonly userDataProfilesService;
private readonly fileService;
private readonly applicationStorageMainService;
private readonly storageMainService;
private readonly configurationService;
private readonly themeMainService;
private readonly workspacesManagementMainService;
private readonly backupMainService;
private readonly telemetryService;
private readonly dialogMainService;
private readonly lifecycleMainService;
private readonly productService;
private readonly protocolMainService;
private readonly windowsMainService;
private readonly stateMainService;
private readonly nativeHostMainService;
private static readonly windowControlHeightStateStorageKey;
private static sandboxState;
private readonly _onWillLoad;
readonly onWillLoad: import("../../../base/common/event.mjs").Event<ILoadEvent>;
private readonly _onDidSignalReady;
readonly onDidSignalReady: import("../../../base/common/event.mjs").Event<void>;
private readonly _onDidTriggerSystemContextMenu;
readonly onDidTriggerSystemContextMenu: import("../../../base/common/event.mjs").Event<{
x: number;
y: number;
}>;
private readonly _onDidClose;
readonly onDidClose: import("../../../base/common/event.mjs").Event<void>;
private readonly _onDidDestroy;
readonly onDidDestroy: import("../../../base/common/event.mjs").Event<void>;
private _id;
get id(): number;
private _win;
get win(): BrowserWindow | null;
private _lastFocusTime;
get lastFocusTime(): number;
get backupPath(): string | undefined;
get openedWorkspace(): IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | undefined;
get profile(): IUserDataProfile | undefined;
get remoteAuthority(): string | undefined;
private _config;
get config(): INativeWindowConfiguration | undefined;
get isExtensionDevelopmentHost(): boolean;
get isExtensionTestHost(): boolean;
get isExtensionDevelopmentTestFromCli(): boolean;
private readonly windowState;
private currentMenuBarVisibility;
private transientIsNativeFullScreen;
private joinNativeFullScreenTransition;
private representedFilename;
private documentEdited;
private readonly hasWindowControlOverlay;
private readonly whenReadyCallbacks;
private readonly touchBarGroups;
private currentHttpProxy;
private currentNoProxy;
private readonly configObjectUrl;
private pendingLoadConfig;
private wasLoaded;
constructor(config: IWindowCreationOptions, logService: ILogService, environmentMainService: IEnvironmentMainService, policyService: IPolicyService, userDataProfilesService: IUserDataProfilesMainService, fileService: IFileService, applicationStorageMainService: IApplicationStorageMainService, storageMainService: IStorageMainService, configurationService: IConfigurationService, themeMainService: IThemeMainService, workspacesManagementMainService: IWorkspacesManagementMainService, backupMainService: IBackupMainService, telemetryService: ITelemetryService, dialogMainService: IDialogMainService, lifecycleMainService: ILifecycleMainService, productService: IProductService, protocolMainService: IProtocolMainService, windowsMainService: IWindowsMainService, stateMainService: IStateMainService, nativeHostMainService: INativeHostMainService);
setRepresentedFilename(filename: string): void;
getRepresentedFilename(): string | undefined;
setDocumentEdited(edited: boolean): void;
isDocumentEdited(): boolean;
focus(options?: {
force: boolean;
}): void;
private readyState;
setReady(): void;
ready(): Promise<ICodeWindow>;
get isReady(): boolean;
get whenClosedOrLoaded(): Promise<void>;
private registerListeners;
private marketplaceHeadersPromise;
private getMarketplaceHeaders;
private onWindowError;
private handleWindowsAdminCrash;
private destroyWindow;
private onDidDeleteUntitledWorkspace;
private onConfigurationUpdated;
addTabbedWindow(window: ICodeWindow): void;
load(configuration: INativeWindowConfiguration, options?: ILoadOptions): void;
private updateConfiguration;
reload(cli?: NativeParsedArgs): Promise<void>;
private validateWorkspaceBeforeReload;
serializeWindowState(): IWindowState;
updateWindowControls(options: {
height?: number;
backgroundColor?: string;
foregroundColor?: string;
}): void;
private restoreWindowState;
private validateWindowState;
private getWorkingArea;
getBounds(): Rectangle;
toggleFullScreen(): void;
private setFullScreen;
get isFullScreen(): boolean;
private setNativeFullScreen;
private doSetNativeFullScreen;
private setSimpleFullScreen;
private useNativeFullScreen;
isMinimized(): boolean;
private getMenuBarVisibility;
private setMenuBarVisibility;
private doSetMenuBarVisibility;
handleTitleDoubleClick(): void;
close(): void;
sendWhenReady(channel: string, token: CancellationToken, ...args: any[]): void;
send(channel: string, ...args: any[]): void;
updateTouchBar(groups: ISerializableCommandAction[][]): void;
private createTouchBar;
private createTouchBarGroup;
private createTouchBarGroupSegments;
dispose(): void;
}
export {};