From b1fb9f780b3bb45183ab0b98f1e59ad27017a0a3 Mon Sep 17 00:00:00 2001 From: Akash Satheesan Date: Fri, 9 Apr 2021 20:20:49 +0530 Subject: [PATCH] fix(lib/vscode): add listProcesses to terminal channel --- lib/vscode/src/vs/server/node/channel.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/vscode/src/vs/server/node/channel.ts b/lib/vscode/src/vs/server/node/channel.ts index 2753db67..769ce639 100644 --- a/lib/vscode/src/vs/server/node/channel.ts +++ b/lib/vscode/src/vs/server/node/channel.ts @@ -674,6 +674,7 @@ export class TerminalProviderChannel implements IServerChannel { + // TODO: args.isInitialization. Maybe this is to have slightly different + // behavior when first listing terminals but I don't know what you'd want to + // do differently. Maybe it's to reset the terminal dispose timeouts or + // something like that, but why not do it each time you list? + const terminals = await Promise.all(Array.from(this.terminals).map(async ([id, terminal]) => { + return terminal.description(id); + })); + + // Only returned orphaned terminals so we don't end up attaching to + // terminals already attached elsewhere. + return terminals.filter((t) => t.isOrphan); + } + public async setTerminalLayoutInfo(args: ISetTerminalLayoutInfoArgs): Promise { this.layouts.set(args.workspaceId, args); }