mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 21:55:38 +00:00
Properly support splitting ext profiles
This commit is contained in:
parent
08cf3df745
commit
5eddbd9d20
|
@ -214,7 +214,7 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
|
|||
public $registerProfileProvider(id: string): void {
|
||||
// Proxy profile provider requests through the extension host
|
||||
this._profileProviders.set(id, this._terminalService.registerTerminalProfileProvider(id, {
|
||||
createContributedTerminalProfile: async () => this._proxy.$createContributedProfileTerminal(id)
|
||||
createContributedTerminalProfile: async (isSplitTerminal) => this._proxy.$createContributedProfileTerminal(id, isSplitTerminal)
|
||||
}));
|
||||
}
|
||||
|
||||
|
|
|
@ -1714,7 +1714,7 @@ export interface ExtHostTerminalServiceShape {
|
|||
$activateLink(id: number, linkId: number): void;
|
||||
$initEnvironmentVariableCollections(collections: [string, ISerializableEnvironmentVariableCollection][]): void;
|
||||
$acceptDefaultProfile(profile: ITerminalProfile, automationProfile: ITerminalProfile): void;
|
||||
$createContributedProfileTerminal(id: string): Promise<void>;
|
||||
$createContributedProfileTerminal(id: string, isSplitTerminal: boolean): Promise<void>;
|
||||
}
|
||||
|
||||
export interface ExtHostSCMShape {
|
||||
|
|
|
@ -144,11 +144,16 @@ export class ExtHostTerminal {
|
|||
});
|
||||
}
|
||||
|
||||
public async createExtensionTerminal(iconPath?: URI | { light: URI; dark: URI } | ThemeIcon): Promise<number> {
|
||||
public async createExtensionTerminal(isSplitTerminal?: boolean, iconPath?: URI | { light: URI; dark: URI } | ThemeIcon): Promise<number> {
|
||||
if (typeof this._id !== 'string') {
|
||||
throw new Error('Terminal has already been created');
|
||||
}
|
||||
await this._proxy.$createTerminal(this._id, { name: this._name, isExtensionCustomPtyTerminal: true, icon: iconPath });
|
||||
await this._proxy.$createTerminal(this._id, {
|
||||
name: this._name,
|
||||
isExtensionCustomPtyTerminal: true,
|
||||
icon: iconPath,
|
||||
isSplitTerminal
|
||||
});
|
||||
// At this point, the id has been set via `$acceptTerminalOpened`
|
||||
if (typeof this._id === 'string') {
|
||||
throw new Error('Terminal creation failed');
|
||||
|
@ -361,10 +366,10 @@ export abstract class BaseExtHostTerminalService extends Disposable implements I
|
|||
return profile?.args || [];
|
||||
}
|
||||
|
||||
public createExtensionTerminal(options: vscode.ExtensionTerminalOptions): vscode.Terminal {
|
||||
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(options.iconPath).then(id => {
|
||||
terminal.createExtensionTerminal(internalOptions?.isSplitTerminal, options.iconPath).then(id => {
|
||||
const disposable = this._setupExtHostProcessListeners(id, p);
|
||||
this._terminalProcessDisposables[id] = disposable;
|
||||
});
|
||||
|
@ -592,7 +597,7 @@ export abstract class BaseExtHostTerminalService extends Disposable implements I
|
|||
});
|
||||
}
|
||||
|
||||
public async $createContributedProfileTerminal(id: string): Promise<void> {
|
||||
public async $createContributedProfileTerminal(id: string, isSplitTerminal: boolean): Promise<void> {
|
||||
// TODO: Use cancellation token
|
||||
const options = await this._profileProviders.get(id)?.provideProfileOptions(new CancellationTokenSource().token);
|
||||
if (!options) {
|
||||
|
@ -600,12 +605,12 @@ export abstract class BaseExtHostTerminalService extends Disposable implements I
|
|||
}
|
||||
if ('pty' in options) {
|
||||
// TODO: Pass in split terminal option
|
||||
this.createExtensionTerminal(options);
|
||||
this.createExtensionTerminal(options, { isSplitTerminal });
|
||||
}
|
||||
// if (options.iconPath) {
|
||||
// checkProposedApiEnabled(extension);
|
||||
// }
|
||||
this.createTerminalFromOptions(options, { isSplitTerminal: true });
|
||||
this.createTerminalFromOptions(options, { isSplitTerminal });
|
||||
}
|
||||
|
||||
public async $provideLinks(terminalId: number, line: string): Promise<ITerminalLinkDto[]> {
|
||||
|
|
Loading…
Reference in a new issue