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

parentTerminal doesn't seem to work #131594

Closed
TylerLeonhardt opened this issue Aug 24, 2021 · 3 comments
Closed

parentTerminal doesn't seem to work #131594

TylerLeonhardt opened this issue Aug 24, 2021 · 3 comments
Assignees
Labels
*not-reproducible Issue cannot be reproduced by VS Code Team member as described

Comments

@TylerLeonhardt
Copy link
Member

Testing #131278

parentTerminal doesn't seem to work... I was trying to basically split all of my terminals with this snippet:

import * as vscode from 'vscode';

export function activate(context: vscode.ExtensionContext) {
  let disposable = vscode.commands.registerCommand('vscode-terminal-fill.givemeterms', () => {
    for (const term of vscode.window.terminals) {
      vscode.window.createTerminal({
        location: {
          parentTerminal: term
        }
      });
    }
  });

  context.subscriptions.push(disposable);
}

adding viewColumn: vscode.ViewColumn.Beside doesn't seem to help either though I don't think that it would.

This is on Linux if it helps. Am I doing something wrong?

@meganrogge
Copy link
Contributor

It works for me
recording (63)

with this code:

context.subscriptions.push(vscode.commands.registerCommand('extensionTerminalSample.create', async () => {

		// Create a terminal in the panel
		const options_1 = {
			name: `Terminal 1`,
			color: new vscode.ThemeColor('terminal.ansiRed'),
			iconPath: { id: 'heart' },
			location: 1
		};
		const terminal_1 = await (<any>vscode.window).createTerminal(options_1);
		terminal_1.show();

		// Create a split terminal using terminal_1 as the parent
		const options_2 = {
			name: 'Terminal 2',
			location: { parentTerminal: terminal_1 },
			shellPath: process.title || 'C:/Windows/System32/cmd.exe',
			iconPath: { id: 'lightbulb'},
			color: new vscode.ThemeColor('terminal.ansiYellow')
		};
		const terminal_2 = await vscode.window.createTerminal(options_2);
		terminal_2.show();

		// Create a split terminal using terminal_1 as the parent
		// should be to the left of terminal_2
		const options_3 = {
			name: 'Terminal 3',
			location: { parentTerminal: terminal_1 },
			shellPath: process.title || 'C:/Windows/System32/cmd.exe',
			iconPath: { id: 'star' },
			color: new vscode.ThemeColor('terminal.ansiCyan')
		};
		const terminal_3 = await vscode.window.createTerminal(options_3);
		terminal_3.show();

		// Create an editor terminal in the active editor group
		const options_4 = {
			name: `Terminal 4`,
			color: new vscode.ThemeColor('terminal.ansiGreen'),
			iconPath: { id: 'smiley' },
			location: {
				viewColumn: vscode.ViewColumn.Beside,
				preserveFocus: false
			}
		};
		const terminal_4 = await (<any>vscode.window).createTerminal(options_4);
		terminal_4.show();

		const options5 = {
			pty,
			name: 'august',
			handleInput: (data: any) => console.log(`handling ${data}`)
		};
		const terminal = await vscode.window.createTerminal(options5);
		setTimeout(() => terminal.sendText('hello'), 400);
		terminal.show();
		let index = 0;
		for (const term of vscode.window.terminals) {
			const opts = {
				name: `Terminal ${index}`,
				location: { parentTerminal: term }
			};
			await vscode.window.createTerminal(opts);
			index++;
		}
	}));

@meganrogge meganrogge added the *not-reproducible Issue cannot be reproduced by VS Code Team member as described label Sep 2, 2021
@meganrogge
Copy link
Contributor

Let me know if the above does not work for you

@github-actions github-actions bot locked and limited conversation to collaborators Oct 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*not-reproducible Issue cannot be reproduced by VS Code Team member as described
Projects
None yet
Development

No branches or pull requests

4 participants
@Tyriar @TylerLeonhardt @meganrogge and others