import type * as vscode from "vscode"; import { Event, Emitter } from "../../../base/common/event.js"; import { ExtHostTerminalServiceShape, MainThreadTerminalServiceShape, ITerminalDimensionsDto, ITerminalLinkDto, ExtHostTerminalIdentifier, ICommandDto, ITerminalQuickFixOpenerDto, ITerminalQuickFixTerminalCommandDto, TerminalCommandMatchResultDto, ITerminalCommandDto, ITerminalCompletionContextDto, TerminalCompletionListDto } from "./extHost.protocol.js"; import { URI } from "../../../base/common/uri.js"; import { IExtHostRpcService } from "./extHostRpcService.js"; import { IDisposable, Disposable } from "../../../base/common/lifecycle.js"; import { TerminalExitReason, TerminalCompletionItem } from "./extHostTypes.js"; import { IExtensionDescription } from "../../../platform/extensions/common/extensions.js"; import { IEnvironmentVariableCollectionDescription, IEnvironmentVariableMutator, ISerializableEnvironmentVariableCollection } from "@codingame/monaco-vscode-xterm-common/vscode/vs/platform/terminal/common/environmentVariable"; import { ICreateContributedTerminalProfileOptions, IShellLaunchConfigDto, ITerminalChildProcess, ITerminalLaunchError, ITerminalProfile, TerminalIcon, TerminalLocation, TerminalShellType } from "../../../platform/terminal/common/terminal.js"; import { ThemeColor } from "../../../base/common/themables.js"; import { IExtHostCommands } from "./extHostCommands.js"; export interface IExtHostTerminalService extends ExtHostTerminalServiceShape, IDisposable { readonly _serviceBrand: undefined; activeTerminal: vscode.Terminal | undefined; terminals: vscode.Terminal[]; readonly onDidCloseTerminal: Event; readonly onDidOpenTerminal: Event; readonly onDidChangeActiveTerminal: Event; readonly onDidChangeTerminalDimensions: Event; readonly onDidChangeTerminalState: Event; readonly onDidWriteTerminalData: Event; readonly onDidExecuteTerminalCommand: Event; readonly onDidChangeShell: Event; createTerminal(name?: string, shellPath?: string, shellArgs?: readonly string[] | string): vscode.Terminal; createTerminalFromOptions(options: vscode.TerminalOptions, internalOptions?: ITerminalInternalOptions): vscode.Terminal; createExtensionTerminal(options: vscode.ExtensionTerminalOptions): vscode.Terminal; attachPtyToTerminal(id: number, pty: vscode.Pseudoterminal): void; getDefaultShell(useAutomationShell: boolean): string; getDefaultShellArgs(useAutomationShell: boolean): string[] | string; registerLinkProvider(provider: vscode.TerminalLinkProvider): vscode.Disposable; registerProfileProvider(extension: IExtensionDescription, id: string, provider: vscode.TerminalProfileProvider): vscode.Disposable; registerTerminalQuickFixProvider(id: string, extensionId: string, provider: vscode.TerminalQuickFixProvider): vscode.Disposable; getEnvironmentVariableCollection(extension: IExtensionDescription): IEnvironmentVariableCollection; getTerminalById(id: number): ExtHostTerminal | null; getTerminalIdByApiObject(apiTerminal: vscode.Terminal): number | null; registerTerminalCompletionProvider(extension: IExtensionDescription, provider: vscode.TerminalCompletionProvider, ...triggerCharacters: string[]): vscode.Disposable; } interface IEnvironmentVariableCollection extends vscode.EnvironmentVariableCollection { getScoped(scope: vscode.EnvironmentVariableScope): vscode.EnvironmentVariableCollection; } export interface ITerminalInternalOptions { cwd?: string | URI; isFeatureTerminal?: boolean; forceShellIntegration?: boolean; useShellEnvironment?: boolean; resolvedExtHostIdentifier?: ExtHostTerminalIdentifier; /** * This location is different from the API location because it can include splitActiveTerminal, * a property we resolve internally */ location?: TerminalLocation | { viewColumn: number; preserveState?: boolean; } | { splitActiveTerminal: boolean; }; } export declare const IExtHostTerminalService: import("../../../platform/instantiation/common/instantiation.js").ServiceIdentifier; export declare class ExtHostTerminal extends Disposable { private _proxy; _id: ExtHostTerminalIdentifier; private readonly _creationOptions; private _name?; private _disposed; private _pidPromise; private _cols; private _pidPromiseComplete; private _rows; private _exitStatus; private _state; private _selection; shellIntegration: vscode.TerminalShellIntegration | undefined; isOpen: boolean; readonly value: vscode.Terminal; protected readonly _onWillDispose: Emitter; readonly onWillDispose: Event; constructor(_proxy: MainThreadTerminalServiceShape, _id: ExtHostTerminalIdentifier, _creationOptions: vscode.TerminalOptions | vscode.ExtensionTerminalOptions, _name?: string | undefined); dispose(): void; create(options: vscode.TerminalOptions, internalOptions?: ITerminalInternalOptions): Promise; createExtensionTerminal(location?: TerminalLocation | vscode.TerminalEditorLocationOptions | vscode.TerminalSplitLocationOptions, internalOptions?: ITerminalInternalOptions, parentTerminal?: ExtHostTerminalIdentifier, iconPath?: TerminalIcon, color?: ThemeColor, shellIntegrationNonce?: string, titleTemplate?: string): Promise; private _serializeParentTerminal; private _checkDisposed; set name(name: string); setExitStatus(code: number | undefined, reason: TerminalExitReason): void; setDimensions(cols: number, rows: number): boolean; setInteractedWith(): boolean; setShellType(shellType: TerminalShellType | undefined): boolean; setSelection(selection: string | undefined): void; _setProcessId(processId: number | undefined): void; } export declare abstract class BaseExtHostTerminalService extends Disposable implements IExtHostTerminalService, ExtHostTerminalServiceShape { private readonly _extHostCommands; readonly _serviceBrand: undefined; protected _proxy: MainThreadTerminalServiceShape; protected _activeTerminal: ExtHostTerminal | undefined; protected _terminals: ExtHostTerminal[]; protected _terminalProcesses: Map; protected _terminalProcessDisposables: { [id: number]: IDisposable; }; protected _extensionTerminalAwaitingStart: { [id: number]: { initialDimensions: ITerminalDimensionsDto | undefined; } | undefined; }; protected _getTerminalPromises: { [id: number]: Promise; }; protected _environmentVariableCollections: Map; private _defaultProfile; private _defaultAutomationProfile; private readonly _lastQuickFixCommands; private readonly _bufferer; private readonly _linkProviders; private readonly _completionProviders; private readonly _profileProviders; private readonly _quickFixProviders; private readonly _terminalLinkCache; private readonly _terminalLinkCancellationSource; get activeTerminal(): vscode.Terminal | undefined; get terminals(): vscode.Terminal[]; protected readonly _onDidCloseTerminal: Emitter; readonly onDidCloseTerminal: Event; protected readonly _onDidOpenTerminal: Emitter; readonly onDidOpenTerminal: Event; protected readonly _onDidChangeActiveTerminal: Emitter; readonly onDidChangeActiveTerminal: Event; protected readonly _onDidChangeTerminalDimensions: Emitter; readonly onDidChangeTerminalDimensions: Event; protected readonly _onDidChangeTerminalState: Emitter; readonly onDidChangeTerminalState: Event; protected readonly _onDidChangeShell: Emitter; readonly onDidChangeShell: Event; protected readonly _onDidWriteTerminalData: Emitter; readonly onDidWriteTerminalData: Event; protected readonly _onDidExecuteCommand: Emitter; readonly onDidExecuteTerminalCommand: Event; constructor(supportsProcesses: boolean, _extHostCommands: IExtHostCommands, extHostRpc: IExtHostRpcService); abstract createTerminal(name?: string, shellPath?: string, shellArgs?: string[] | string): vscode.Terminal; abstract createTerminalFromOptions(options: vscode.TerminalOptions, internalOptions?: ITerminalInternalOptions): vscode.Terminal; getDefaultShell(useAutomationShell: boolean): string; getDefaultShellArgs(useAutomationShell: boolean): string[] | string; createExtensionTerminal(options: vscode.ExtensionTerminalOptions, internalOptions?: ITerminalInternalOptions): vscode.Terminal; protected _serializeParentTerminal(options: vscode.TerminalOptions, internalOptions?: ITerminalInternalOptions): ITerminalInternalOptions; attachPtyToTerminal(id: number, pty: vscode.Pseudoterminal): void; $acceptActiveTerminalChanged(id: number | null): Promise; $acceptTerminalProcessData(id: number, data: string): Promise; $acceptTerminalDimensions(id: number, cols: number, rows: number): Promise; $acceptDidExecuteCommand(id: number, command: ITerminalCommandDto): Promise; $acceptTerminalMaximumDimensions(id: number, cols: number, rows: number): Promise; $acceptTerminalTitleChange(id: number, name: string): Promise; $acceptTerminalClosed(id: number, exitCode: number | undefined, exitReason: TerminalExitReason): Promise; $acceptTerminalOpened(id: number, extHostTerminalId: string | undefined, name: string, shellLaunchConfigDto: IShellLaunchConfigDto): void; $acceptTerminalProcessId(id: number, processId: number): Promise; $startExtensionTerminal(id: number, initialDimensions: ITerminalDimensionsDto | undefined): Promise; protected _setupExtHostProcessListeners(id: number, p: ITerminalChildProcess): IDisposable; $acceptProcessAckDataEvent(id: number, charCount: number): void; $acceptProcessInput(id: number, data: string): void; $acceptTerminalInteraction(id: number): void; $acceptTerminalSelection(id: number, selection: string | undefined): void; $acceptProcessResize(id: number, cols: number, rows: number): void; $acceptProcessShutdown(id: number, immediate: boolean): void; $acceptProcessRequestInitialCwd(id: number): void; $acceptProcessRequestCwd(id: number): void; $acceptProcessRequestLatency(id: number): Promise; registerProfileProvider(extension: IExtensionDescription, id: string, provider: vscode.TerminalProfileProvider): vscode.Disposable; registerTerminalCompletionProvider(extension: IExtensionDescription, provider: vscode.TerminalCompletionProvider, ...triggerCharacters: string[]): vscode.Disposable; $provideTerminalCompletions(id: string, options: ITerminalCompletionContextDto): Promise; $acceptTerminalShellType(id: number, shellType: TerminalShellType | undefined): void; registerTerminalQuickFixProvider(id: string, extensionId: string, provider: vscode.TerminalQuickFixProvider): vscode.Disposable; $provideTerminalQuickFixes(id: string, matchResult: TerminalCommandMatchResultDto): Promise<(ITerminalQuickFixTerminalCommandDto | ITerminalQuickFixOpenerDto | ICommandDto)[] | ITerminalQuickFixTerminalCommandDto | ITerminalQuickFixOpenerDto | ICommandDto | undefined>; $createContributedProfileTerminal(id: string, options: ICreateContributedTerminalProfileOptions): Promise; registerLinkProvider(provider: vscode.TerminalLinkProvider): vscode.Disposable; $provideLinks(terminalId: number, line: string): Promise; $activateLink(terminalId: number, linkId: number): void; private _onProcessExit; getTerminalById(id: number): ExtHostTerminal | null; getTerminalIdByApiObject(terminal: vscode.Terminal): number | null; private _getTerminalObjectById; private _getTerminalObjectIndexById; getEnvironmentVariableCollection(extension: IExtensionDescription): IEnvironmentVariableCollection; private _syncEnvironmentVariableCollection; $initEnvironmentVariableCollections(collections: [ string, ISerializableEnvironmentVariableCollection ][]): void; $acceptDefaultProfile(profile: ITerminalProfile, automationProfile: ITerminalProfile): void; private _setEnvironmentVariableCollection; } /** * Unified environment variable collection carrying information for all scopes, for a specific extension. */ declare class UnifiedEnvironmentVariableCollection extends Disposable { readonly map: Map; private readonly scopedCollections; readonly descriptionMap: Map; private _persistent; get persistent(): boolean; set persistent(value: boolean); protected readonly _onDidChangeCollection: Emitter; get onDidChangeCollection(): Event; constructor(serialized?: ISerializableEnvironmentVariableCollection); getScopedEnvironmentVariableCollection(scope: vscode.EnvironmentVariableScope | undefined): IEnvironmentVariableCollection; replace(variable: string, value: string, options: vscode.EnvironmentVariableMutatorOptions | undefined, scope: vscode.EnvironmentVariableScope | undefined): void; append(variable: string, value: string, options: vscode.EnvironmentVariableMutatorOptions | undefined, scope: vscode.EnvironmentVariableScope | undefined): void; prepend(variable: string, value: string, options: vscode.EnvironmentVariableMutatorOptions | undefined, scope: vscode.EnvironmentVariableScope | undefined): void; private _setIfDiffers; get(variable: string, scope: vscode.EnvironmentVariableScope | undefined): vscode.EnvironmentVariableMutator | undefined; private getKey; private getScopeKey; private getWorkspaceKey; getVariableMap(scope: vscode.EnvironmentVariableScope | undefined): Map; delete(variable: string, scope: vscode.EnvironmentVariableScope | undefined): void; clear(scope: vscode.EnvironmentVariableScope | undefined): void; setDescription(description: string | vscode.MarkdownString | undefined, scope: vscode.EnvironmentVariableScope | undefined): void; getDescription(scope: vscode.EnvironmentVariableScope | undefined): string | vscode.MarkdownString | undefined; private clearDescription; } export declare class WorkerExtHostTerminalService extends BaseExtHostTerminalService { constructor(extHostCommands: IExtHostCommands, extHostRpc: IExtHostRpcService); createTerminal(name?: string, shellPath?: string, shellArgs?: string[] | string): vscode.Terminal; createTerminalFromOptions(options: vscode.TerminalOptions, internalOptions?: ITerminalInternalOptions): vscode.Terminal; } export {};