From 9b73c75d7464eccd46a5f8a5607fdf741d66c935 Mon Sep 17 00:00:00 2001 From: mbianchidev Date: Mon, 24 Oct 2022 11:31:08 +0200 Subject: [PATCH] Should fix split terminal issue where profile is not loaded on second terminal (if specified in JSON) --- src/model.ts | 1 + src/restoreTerminals.ts | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/model.ts b/src/model.ts index 94925af..640fe2d 100644 --- a/src/model.ts +++ b/src/model.ts @@ -2,6 +2,7 @@ import type { TerminalOptions } from "vscode"; export interface TerminalConfig { commands?: string[]; + profile?: string; name?: string; icon?: string; color?: string; diff --git a/src/restoreTerminals.ts b/src/restoreTerminals.ts index 3ccf42d..f68a110 100644 --- a/src/restoreTerminals.ts +++ b/src/restoreTerminals.ts @@ -89,7 +89,8 @@ export default async function restoreTerminals(configuration: Configuration) { const splitTerminal = terminalWindow.splitTerminals[i]; const createdSplitTerm = await createNewSplitTerminal( splitTerminal.name, - splitTerminal.icon + splitTerminal.icon, + splitTerminal.profile ); const { commands, shouldRunCommands } = splitTerminal; commands && @@ -119,12 +120,20 @@ async function runCommands( } async function createNewSplitTerminal( + profile: string | undefined, name: string | undefined, - icon: string | undefined + icon: string | undefined, ): Promise { return new Promise(async (resolve, reject) => { const numTermsBefore = vscode.window.terminals.length; await vscode.commands.executeCommand("workbench.action.terminal.split"); + if (profile) { + await vscode.commands.executeCommand( + "workbench.action.terminal.newWithProfile", + { + profile, + }); + } if (name) { await vscode.commands.executeCommand( "workbench.action.terminal.renameWithArg",