Merge pull request #132870 from microsoft/tyriar/r160_pty
Fix launching Pseudoterminal-based and local terminals in remote workspaces before the connection is established
This commit is contained in:
commit
83bd43bc51
|
@ -140,13 +140,15 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
|
|||
isExtensionOwnedTerminal: launchConfig.isExtensionOwnedTerminal,
|
||||
useShellEnvironment: launchConfig.useShellEnvironment,
|
||||
};
|
||||
this._extHostTerminals.set(extHostTerminalId, new Promise(async r => {
|
||||
const terminal = new Promise<ITerminalInstance>(async r => {
|
||||
const terminal = await this._terminalService.createTerminal({
|
||||
config: shellLaunchConfig,
|
||||
location: await this._deserializeParentTerminal(launchConfig.location)
|
||||
});
|
||||
r(terminal);
|
||||
}));
|
||||
});
|
||||
this._extHostTerminals.set(extHostTerminalId, terminal);
|
||||
await terminal;
|
||||
}
|
||||
|
||||
private async _deserializeParentTerminal(location?: TerminalLocation | TerminalEditorLocationOptions | { parentTerminal: ExtHostTerminalIdentifier } | { splitActiveTerminal: boolean, location?: TerminalLocation }): Promise<TerminalLocation | TerminalEditorLocationOptions | { parentTerminal: ITerminalInstance } | { splitActiveTerminal: boolean } | undefined> {
|
||||
|
|
|
@ -1148,9 +1148,17 @@ export class TerminalService implements ITerminalService {
|
|||
|
||||
|
||||
async createTerminal(options?: ICreateTerminalOptions): Promise<ITerminalInstance> {
|
||||
// Await the initialization of available profiles as long as this is not a pty terminal or a
|
||||
// local terminal in a remote workspace as profile won't be used in those cases and these
|
||||
// terminals need to be launched before remote connections are established.
|
||||
if (!this._availableProfiles) {
|
||||
await this._refreshAvailableProfilesNow();
|
||||
const isPtyTerminal = options?.config && 'customPtyImplementation' in options.config;
|
||||
const isLocalInRemoteTerminal = this._remoteAgentService.getConnection() && URI.isUri(options?.cwd) && options?.cwd.scheme === Schemas.vscodeFileResource;
|
||||
if (!isPtyTerminal && !isLocalInRemoteTerminal) {
|
||||
await this._refreshAvailableProfilesNow();
|
||||
}
|
||||
}
|
||||
|
||||
const config = options?.config || this._availableProfiles?.find(p => p.profileName === this._defaultProfileName);
|
||||
const shellLaunchConfig = config && 'extensionIdentifier' in config ? {} : this._convertProfileToShellLaunchConfig(config || {});
|
||||
|
||||
|
|
Loading…
Reference in a new issue