sussudio
Version:
An unofficial VS Code Internal API
80 lines (79 loc) • 3.6 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 { WebContents } from 'electron';
import { Event } from "../../../base/common/event.mjs";
import { IProcessEnvironment } from "../../../base/common/platform.mjs";
import { URI } from "../../../base/common/uri.mjs";
import { NativeParsedArgs } from "../../environment/common/argv.mjs";
import { ICodeWindow } from "../../window/electron-main/window.mjs";
import { IOpenEmptyWindowOptions, IWindowOpenable } from "../../window/common/window.mjs";
export declare const IWindowsMainService: import("../../instantiation/common/instantiation.mjs").ServiceIdentifier<IWindowsMainService>;
export interface IWindowsMainService {
readonly _serviceBrand: undefined;
readonly onDidChangeWindowsCount: Event<IWindowsCountChangedEvent>;
readonly onDidOpenWindow: Event<ICodeWindow>;
readonly onDidSignalReadyWindow: Event<ICodeWindow>;
readonly onDidTriggerSystemContextMenu: Event<{
window: ICodeWindow;
x: number;
y: number;
}>;
readonly onDidDestroyWindow: Event<ICodeWindow>;
open(openConfig: IOpenConfiguration): Promise<ICodeWindow[]>;
openEmptyWindow(openConfig: IOpenEmptyConfiguration, options?: IOpenEmptyWindowOptions): Promise<ICodeWindow[]>;
openExtensionDevelopmentHostWindow(extensionDevelopmentPath: string[], openConfig: IOpenConfiguration): Promise<ICodeWindow[]>;
openExistingWindow(window: ICodeWindow, openConfig: IOpenConfiguration): void;
sendToFocused(channel: string, ...args: any[]): void;
sendToAll(channel: string, payload?: any, windowIdsToIgnore?: number[]): void;
getWindows(): ICodeWindow[];
getWindowCount(): number;
getFocusedWindow(): ICodeWindow | undefined;
getLastActiveWindow(): ICodeWindow | undefined;
getWindowById(windowId: number): ICodeWindow | undefined;
getWindowByWebContents(webContents: WebContents): ICodeWindow | undefined;
}
export interface IWindowsCountChangedEvent {
readonly oldCount: number;
readonly newCount: number;
}
export declare const enum OpenContext {
CLI = 0,
DOCK = 1,
MENU = 2,
DIALOG = 3,
DESKTOP = 4,
API = 5
}
export interface IBaseOpenConfiguration {
readonly context: OpenContext;
readonly contextWindowId?: number;
}
export interface IOpenConfiguration extends IBaseOpenConfiguration {
readonly cli: NativeParsedArgs;
readonly userEnv?: IProcessEnvironment;
readonly urisToOpen?: IWindowOpenable[];
readonly waitMarkerFileURI?: URI;
readonly preferNewWindow?: boolean;
readonly forceNewWindow?: boolean;
readonly forceNewTabbedWindow?: boolean;
readonly forceReuseWindow?: boolean;
readonly forceEmpty?: boolean;
readonly diffMode?: boolean;
readonly mergeMode?: boolean;
addMode?: boolean;
readonly gotoLineMode?: boolean;
readonly initialStartup?: boolean;
readonly noRecentEntry?: boolean;
/**
* The remote authority to use when windows are opened with either
* - no workspace (empty window)
* - a workspace that is neither `file://` nor `vscode-remote://`
*/
readonly remoteAuthority?: string;
readonly forceProfile?: string;
readonly forceTempProfile?: boolean;
}
export interface IOpenEmptyConfiguration extends IBaseOpenConfiguration {
}