use title for terminal selection

This commit is contained in:
Daniel Gary
2021-05-07 15:17:17 -05:00
parent 6f7d8dbffb
commit 791caebcc5

View File

@@ -82,8 +82,10 @@ export class ExtHostDebugService extends ExtHostDebugServiceBase {
const shell = this._terminalService.getDefaultShell(true, configProvider);
const shellArgs = this._terminalService.getDefaultShellArgs(true, configProvider);
const terminalName = args.title || nls.localize('debug.terminal.title', "debuggee");
const shellConfig = JSON.stringify({ shell, shellArgs });
let terminal = await this._integratedTerminalInstances.checkout(shellConfig);
let terminal = await this._integratedTerminalInstances.checkout(shellConfig, terminalName);
let cwdForPrepareCommand: string | undefined;
let giveShellTimeToInitialize = false;
@@ -93,7 +95,7 @@ export class ExtHostDebugService extends ExtHostDebugServiceBase {
shellPath: shell,
shellArgs: shellArgs,
cwd: args.cwd,
name: args.title || nls.localize('debug.terminal.title', "debuggee"),
name: terminalName,
};
giveShellTimeToInitialize = true;
terminal = this._terminalService.createTerminalFromOptions(options, true);
@@ -157,9 +159,15 @@ class DebugTerminalCollection {
private _terminalInstances = new Map<vscode.Terminal, { lastUsedAt: number, config: string }>();
public async checkout(config: string) {
public async checkout(config: string, name: string) {
const entries = [...this._terminalInstances.entries()];
const promises = entries.map(([terminal, termInfo]) => createCancelablePromise(async ct => {
// Only allow terminals that match the title. See #123189
if (terminal.name !== name) {
return null;
}
if (termInfo.lastUsedAt !== -1 && await hasChildProcesses(await terminal.processId)) {
return null;
}