Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix split terminal issue - profile is now configurable on each split terminal instead of root #40

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { TerminalOptions } from "vscode";

export interface TerminalConfig {
commands?: string[];
profile?: string;
name?: string;
shouldRunCommands?: boolean; //whether to actually run the commands, or just paste them in
}
Expand Down
18 changes: 15 additions & 3 deletions src/restoreTerminals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,11 @@ export default async function restoreTerminals(configuration: Configuration) {

for (let i = 1; i < terminalWindow.splitTerminals.length; i++) {
const splitTerminal = terminalWindow.splitTerminals[i];
const createdSplitTerm = await createNewSplitTerminal(splitTerminal.name);

const createdSplitTerm = await createNewSplitTerminal(
splitTerminal.name,
splitTerminal.icon,
splitTerminal.profile
);
const { commands, shouldRunCommands } = splitTerminal;
commands &&
commandsToRunInTerms.push({
Expand Down Expand Up @@ -95,11 +98,20 @@ async function runCommands(
}

async function createNewSplitTerminal(
name: string | undefined
profile: string | undefined,
name: string | undefined,
icon: string | undefined,
): Promise<vscode.Terminal> {
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",
Expand Down