mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 02:58:56 +01:00
@@ -146,13 +146,16 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
|
||||
};
|
||||
let terminal: ITerminalInstance | undefined;
|
||||
if (launchConfig.isSplitTerminal) {
|
||||
const activeInstance = this._terminalService.activeInstance;
|
||||
const activeInstance = this._terminalService.getInstanceHost(launchConfig.target).activeInstance;
|
||||
if (activeInstance) {
|
||||
terminal = withNullAsUndefined(this._terminalService.splitInstance(activeInstance, shellLaunchConfig));
|
||||
}
|
||||
}
|
||||
if (!terminal) {
|
||||
terminal = this._terminalService.createTerminal({ config: shellLaunchConfig });
|
||||
terminal = this._terminalService.createTerminal({
|
||||
config: shellLaunchConfig,
|
||||
target: launchConfig.target
|
||||
});
|
||||
}
|
||||
this._extHostTerminalIds.set(extHostTerminalId, terminal.instanceId);
|
||||
}
|
||||
@@ -215,8 +218,8 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
|
||||
public $registerProfileProvider(id: string, extensionIdentifier: string): void {
|
||||
// Proxy profile provider requests through the extension host
|
||||
this._profileProviders.set(id, this._terminalService.registerTerminalProfileProvider(extensionIdentifier, id, {
|
||||
createContributedTerminalProfile: async (isSplitTerminal) => {
|
||||
return this._proxy.$createContributedProfileTerminal(id, isSplitTerminal);
|
||||
createContributedTerminalProfile: async (options) => {
|
||||
return this._proxy.$createContributedProfileTerminal(id, options);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ import { IRemoteConnectionData, RemoteAuthorityResolverErrorCode, ResolverResult
|
||||
import { ProvidedPortAttributes, TunnelCreationOptions, TunnelOptions, TunnelProviderFeatures } from 'vs/platform/remote/common/tunnel';
|
||||
import { ClassifiedEvent, GDPRClassification, StrictPropertyCheck } from 'vs/platform/telemetry/common/gdprTypings';
|
||||
import { ITelemetryInfo } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IShellLaunchConfig, IShellLaunchConfigDto, ITerminalDimensions, ITerminalEnvironment, ITerminalLaunchError, ITerminalProfile } from 'vs/platform/terminal/common/terminal';
|
||||
import { ICreateContributedTerminalProfileOptions, IShellLaunchConfig, IShellLaunchConfigDto, ITerminalDimensions, ITerminalEnvironment, ITerminalLaunchError, ITerminalProfile, TerminalLocation } from 'vs/platform/terminal/common/terminal';
|
||||
import { ThemeColor, ThemeIcon } from 'vs/platform/theme/common/themeService';
|
||||
import { IExtensionIdWithVersion } from 'vs/platform/userDataSync/common/extensionsStorageSync';
|
||||
import { WorkspaceTrustRequestOptions } from 'vs/platform/workspace/common/workspaceTrust';
|
||||
@@ -474,6 +474,7 @@ export interface TerminalLaunchConfig {
|
||||
isExtensionOwnedTerminal?: boolean;
|
||||
useShellEnvironment?: boolean;
|
||||
isSplitTerminal?: boolean;
|
||||
target?: TerminalLocation;
|
||||
}
|
||||
|
||||
export interface MainThreadTerminalServiceShape extends IDisposable {
|
||||
@@ -1727,7 +1728,7 @@ export interface ExtHostTerminalServiceShape {
|
||||
$activateLink(id: number, linkId: number): void;
|
||||
$initEnvironmentVariableCollections(collections: [string, ISerializableEnvironmentVariableCollection][]): void;
|
||||
$acceptDefaultProfile(profile: ITerminalProfile, automationProfile: ITerminalProfile): void;
|
||||
$createContributedProfileTerminal(id: string, isSplitTerminal: boolean): Promise<void>;
|
||||
$createContributedProfileTerminal(id: string, options: ICreateContributedTerminalProfileOptions): Promise<void>;
|
||||
}
|
||||
|
||||
export interface ExtHostSCMShape {
|
||||
|
||||
@@ -18,7 +18,7 @@ import { serializeEnvironmentVariableCollection } from 'vs/workbench/contrib/ter
|
||||
import { CancellationTokenSource } from 'vs/base/common/cancellation';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import { ISerializableEnvironmentVariableCollection } from 'vs/workbench/contrib/terminal/common/environmentVariable';
|
||||
import { IProcessReadyEvent, IShellLaunchConfigDto, ITerminalChildProcess, ITerminalDimensionsOverride, ITerminalLaunchError, ITerminalProfile, TerminalIcon, TerminalShellType } from 'vs/platform/terminal/common/terminal';
|
||||
import { ICreateContributedTerminalProfileOptions, IProcessReadyEvent, IShellLaunchConfigDto, ITerminalChildProcess, ITerminalDimensionsOverride, ITerminalLaunchError, ITerminalProfile, TerminalIcon, TerminalLocation, TerminalShellType } from 'vs/platform/terminal/common/terminal';
|
||||
import { TerminalDataBufferer } from 'vs/platform/terminal/common/terminalDataBuffering';
|
||||
import { ThemeIcon } from 'vs/platform/theme/common/themeService';
|
||||
import { withNullAsUndefined } from 'vs/base/common/types';
|
||||
@@ -51,6 +51,7 @@ export interface ITerminalInternalOptions {
|
||||
isFeatureTerminal?: boolean;
|
||||
useShellEnvironment?: boolean;
|
||||
isSplitTerminal?: boolean;
|
||||
target?: TerminalLocation;
|
||||
}
|
||||
|
||||
export const IExtHostTerminalService = createDecorator<IExtHostTerminalService>('IExtHostTerminalService');
|
||||
@@ -140,11 +141,12 @@ export class ExtHostTerminal {
|
||||
isFeatureTerminal: withNullAsUndefined(internalOptions?.isFeatureTerminal),
|
||||
isExtensionOwnedTerminal: true,
|
||||
useShellEnvironment: withNullAsUndefined(internalOptions?.useShellEnvironment),
|
||||
isSplitTerminal: withNullAsUndefined(internalOptions?.isSplitTerminal)
|
||||
isSplitTerminal: internalOptions?.isSplitTerminal,
|
||||
target: internalOptions?.target
|
||||
});
|
||||
}
|
||||
|
||||
public async createExtensionTerminal(isSplitTerminal?: boolean, iconPath?: URI | { light: URI; dark: URI } | ThemeIcon): Promise<number> {
|
||||
public async createExtensionTerminal(isSplitTerminal?: boolean, target?: TerminalLocation, iconPath?: URI | { light: URI; dark: URI } | ThemeIcon): Promise<number> {
|
||||
if (typeof this._id !== 'string') {
|
||||
throw new Error('Terminal has already been created');
|
||||
}
|
||||
@@ -152,7 +154,8 @@ export class ExtHostTerminal {
|
||||
name: this._name,
|
||||
isExtensionCustomPtyTerminal: true,
|
||||
icon: iconPath,
|
||||
isSplitTerminal
|
||||
isSplitTerminal,
|
||||
target
|
||||
});
|
||||
// At this point, the id has been set via `$acceptTerminalOpened`
|
||||
if (typeof this._id === 'string') {
|
||||
@@ -369,7 +372,7 @@ export abstract class BaseExtHostTerminalService extends Disposable implements I
|
||||
public createExtensionTerminal(options: vscode.ExtensionTerminalOptions, internalOptions?: ITerminalInternalOptions): vscode.Terminal {
|
||||
const terminal = new ExtHostTerminal(this._proxy, generateUuid(), options, options.name);
|
||||
const p = new ExtHostPseudoterminal(options.pty);
|
||||
terminal.createExtensionTerminal(internalOptions?.isSplitTerminal, asTerminalIcon(options.iconPath)).then(id => {
|
||||
terminal.createExtensionTerminal(internalOptions?.isSplitTerminal, internalOptions?.target, asTerminalIcon(options.iconPath)).then(id => {
|
||||
const disposable = this._setupExtHostProcessListeners(id, p);
|
||||
this._terminalProcessDisposables[id] = disposable;
|
||||
});
|
||||
@@ -596,7 +599,7 @@ export abstract class BaseExtHostTerminalService extends Disposable implements I
|
||||
});
|
||||
}
|
||||
|
||||
public async $createContributedProfileTerminal(id: string, isSplitTerminal: boolean): Promise<void> {
|
||||
public async $createContributedProfileTerminal(id: string, options: ICreateContributedTerminalProfileOptions): Promise<void> {
|
||||
const token = new CancellationTokenSource().token;
|
||||
const profile = await this._profileProviders.get(id)?.provideTerminalProfile(token);
|
||||
if (token.isCancellationRequested) {
|
||||
@@ -606,10 +609,10 @@ export abstract class BaseExtHostTerminalService extends Disposable implements I
|
||||
throw new Error(`No terminal profile options provided for id "${id}"`);
|
||||
}
|
||||
if ('pty' in profile.options) {
|
||||
this.createExtensionTerminal(profile.options, { isSplitTerminal });
|
||||
this.createExtensionTerminal(profile.options, options);
|
||||
return;
|
||||
}
|
||||
this.createTerminalFromOptions(profile.options, { isSplitTerminal });
|
||||
this.createTerminalFromOptions(profile.options, options);
|
||||
}
|
||||
|
||||
public async $provideLinks(terminalId: number, line: string): Promise<ITerminalLinkDto[]> {
|
||||
|
||||
Reference in New Issue
Block a user