未验证 提交 83bd43bc 编写于 作者: D Daniel Imms 提交者: GitHub

Merge pull request #132870 from microsoft/tyriar/r160_pty

Fix launching Pseudoterminal-based and local terminals in remote workspaces before the connection is established
......@@ -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 || {});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册