mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 01:58:53 +01:00
Merge pull request #123478 from danielgary/main
use title for terminal selection
This commit is contained in:
@@ -84,8 +84,10 @@ export class ExtHostDebugService extends ExtHostDebugServiceBase {
|
||||
const shell = this._terminalService.getDefaultShell(true);
|
||||
const shellArgs = this._terminalService.getDefaultShellArgs(true);
|
||||
|
||||
const terminalName = args.title || nls.localize('debug.terminal.title', "Debug Process");
|
||||
|
||||
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;
|
||||
@@ -95,7 +97,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, {
|
||||
@@ -162,9 +164,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