mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-22 17:48:56 +01:00
use title for terminal selection
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user