mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-02 14:31:31 +01:00
combine splitInstance with createTerminal (#130106)
This commit is contained in:
@@ -386,32 +386,6 @@ export interface IShellLaunchConfig {
|
||||
color?: string;
|
||||
}
|
||||
|
||||
export interface ICreateTerminalOptions {
|
||||
/**
|
||||
* The shell launch config or profile to launch with, when not specified the default terminal
|
||||
* profile will be used.
|
||||
*/
|
||||
config?: IShellLaunchConfig | ITerminalProfile | IExtensionTerminalProfile;
|
||||
/**
|
||||
* The current working directory to start with, this will override IShellLaunchConfig.cwd if
|
||||
* specified.
|
||||
*/
|
||||
cwd?: string | URI;
|
||||
/**
|
||||
* Where to create the terminal, when not specified the default target will be used.
|
||||
*/
|
||||
target?: TerminalLocation;
|
||||
/**
|
||||
* Creates a split terminal without requiring a terminal instance to split, for example when splitting
|
||||
* a terminal editor
|
||||
*/
|
||||
forceSplit?: boolean;
|
||||
/**
|
||||
* The terminal's resource, passed when the terminal has moved windows.
|
||||
*/
|
||||
resource?: URI;
|
||||
}
|
||||
|
||||
export interface ICreateContributedTerminalProfileOptions {
|
||||
target?: TerminalLocation;
|
||||
icon?: string;
|
||||
|
||||
@@ -143,7 +143,7 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
|
||||
if (launchConfig.isSplitTerminal) {
|
||||
const activeInstance = this._terminalService.getInstanceHost(launchConfig.target).activeInstance;
|
||||
if (activeInstance) {
|
||||
terminal = withNullAsUndefined(await this._terminalService.splitInstance(activeInstance, shellLaunchConfig));
|
||||
terminal = withNullAsUndefined(await this._terminalService.createTerminal({ instanceToSplit: activeInstance, config: shellLaunchConfig }));
|
||||
}
|
||||
}
|
||||
if (!terminal) {
|
||||
|
||||
@@ -1302,7 +1302,7 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
|
||||
if (terminal.group === group) {
|
||||
const originalInstance = terminal.terminal;
|
||||
await originalInstance.waitForTitle();
|
||||
result = await this.terminalService.splitInstance(originalInstance, launchConfigs);
|
||||
result = await this.terminalService.createTerminal({ instanceToSplit: originalInstance, config: launchConfigs });
|
||||
if (result) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { FindReplaceState } from 'vs/editor/contrib/find/findState';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IShellLaunchConfig, ITerminalChildProcess, ITerminalDimensions, ITerminalLaunchError, ITerminalProfile, ITerminalTabLayoutInfoById, TerminalIcon, TitleEventSource, TerminalShellType, ICreateContributedTerminalProfileOptions, ICreateTerminalOptions, TerminalLocation, IExtensionTerminalProfile, ITerminalProfileType } from 'vs/platform/terminal/common/terminal';
|
||||
import { IShellLaunchConfig, ITerminalChildProcess, ITerminalDimensions, ITerminalLaunchError, ITerminalProfile, ITerminalTabLayoutInfoById, TerminalIcon, TitleEventSource, TerminalShellType, ICreateContributedTerminalProfileOptions, TerminalLocation, IExtensionTerminalProfile, ITerminalProfileType } from 'vs/platform/terminal/common/terminal';
|
||||
import { ICommandTracker, INavigationMode, IOffProcessTerminalService, IRemoteTerminalAttachTarget, IStartExtensionTerminalRequest, ITerminalConfigHelper, ITerminalProcessExtHostProxy } from 'vs/workbench/contrib/terminal/common/terminal';
|
||||
import type { Terminal as XTermTerminal } from 'xterm';
|
||||
import type { SearchAddon as XTermSearchAddon } from 'xterm-addon-search';
|
||||
@@ -142,7 +142,6 @@ export interface ITerminalService extends ITerminalInstanceHost {
|
||||
|
||||
|
||||
getActiveOrCreateInstance(): Promise<ITerminalInstance>;
|
||||
splitInstance(instance: ITerminalInstance, shell?: ITerminalProfile | IShellLaunchConfig | IExtensionTerminalProfile | undefined, cwd?: string | URI): Promise<ITerminalInstance>;
|
||||
moveToEditor(source: ITerminalInstance): void;
|
||||
moveToTerminalView(source?: ITerminalInstance | URI): Promise<void>;
|
||||
getOffProcessTerminalService(): IOffProcessTerminalService | undefined;
|
||||
@@ -206,6 +205,36 @@ export interface ITerminalEditorService extends ITerminalInstanceHost, ITerminal
|
||||
revealActiveEditor(preserveFocus?: boolean): void
|
||||
}
|
||||
|
||||
export interface ICreateTerminalOptions {
|
||||
/**
|
||||
* The shell launch config or profile to launch with, when not specified the default terminal
|
||||
* profile will be used.
|
||||
*/
|
||||
config?: IShellLaunchConfig | ITerminalProfile | IExtensionTerminalProfile;
|
||||
/**
|
||||
* The current working directory to start with, this will override IShellLaunchConfig.cwd if
|
||||
* specified.
|
||||
*/
|
||||
cwd?: string | URI;
|
||||
/**
|
||||
* Where to create the terminal, when not specified the default target will be used.
|
||||
*/
|
||||
target?: TerminalLocation;
|
||||
/**
|
||||
* Creates a split terminal without requiring a terminal instance to split, for example when splitting
|
||||
* a terminal editor
|
||||
*/
|
||||
forceSplit?: boolean;
|
||||
/**
|
||||
* The terminal's resource, passed when the terminal has moved windows.
|
||||
*/
|
||||
resource?: URI;
|
||||
/**
|
||||
* The terminal instance to split
|
||||
*/
|
||||
instanceToSplit?: ITerminalInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
* This service is responsible for managing terminal groups, that is the terminals that are hosted
|
||||
* within the terminal panel, not in an editor.
|
||||
|
||||
@@ -27,13 +27,13 @@ import { IListService } from 'vs/platform/list/browser/listService';
|
||||
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
|
||||
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||
import { IPickOptions, IQuickInputService, IQuickPickItem } from 'vs/platform/quickinput/common/quickInput';
|
||||
import { ICreateTerminalOptions, ITerminalProfile, TerminalLocation, TerminalSettingId, TitleEventSource } from 'vs/platform/terminal/common/terminal';
|
||||
import { ITerminalProfile, TerminalLocation, TerminalSettingId, TitleEventSource } from 'vs/platform/terminal/common/terminal';
|
||||
import { IWorkspaceContextService, IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
|
||||
import { PICK_WORKSPACE_FOLDER_COMMAND_ID } from 'vs/workbench/browser/actions/workspaceCommands';
|
||||
import { CLOSE_EDITOR_COMMAND_ID } from 'vs/workbench/browser/parts/editor/editorCommands';
|
||||
import { ResourceContextKey } from 'vs/workbench/common/resources';
|
||||
import { FindInFilesCommand, IFindInFilesArgs } from 'vs/workbench/contrib/search/browser/searchActions';
|
||||
import { Direction, IRemoteTerminalService, ITerminalGroupService, ITerminalInstance, ITerminalInstanceService, ITerminalService } from 'vs/workbench/contrib/terminal/browser/terminal';
|
||||
import { Direction, ICreateTerminalOptions, IRemoteTerminalService, ITerminalGroupService, ITerminalInstance, ITerminalInstanceService, ITerminalService } from 'vs/workbench/contrib/terminal/browser/terminal';
|
||||
import { TerminalQuickAccessProvider } from 'vs/workbench/contrib/terminal/browser/terminalQuickAccess';
|
||||
import { ILocalTerminalService, IRemoteTerminalAttachTarget, ITerminalConfigHelper, TerminalCommandId, TERMINAL_ACTION_CATEGORY } from 'vs/workbench/contrib/terminal/common/terminal';
|
||||
import { TerminalContextKeys } from 'vs/workbench/contrib/terminal/common/terminalContextKey';
|
||||
@@ -1433,7 +1433,7 @@ export function registerTerminalActions() {
|
||||
if (cwd === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
const instance = await terminalService.splitInstance(activeInstance, options?.config, cwd);
|
||||
const instance = await terminalService.createTerminal({ instanceToSplit: activeInstance, config: options?.config, cwd, target: activeInstance.target });
|
||||
if (instance) {
|
||||
if (instance.target === TerminalLocation.Editor) {
|
||||
instance.focusWhenReady();
|
||||
@@ -1471,7 +1471,7 @@ export function registerTerminalActions() {
|
||||
terminalService.setActiveInstance(t);
|
||||
terminalService.doWithActiveInstance(async instance => {
|
||||
const cwd = await getCwdForSplit(terminalService.configHelper, instance);
|
||||
await terminalService.splitInstance(instance, { cwd });
|
||||
await terminalService.createTerminal({ instanceToSplit: instance, cwd });
|
||||
await terminalGroupService.showPanel(true);
|
||||
});
|
||||
}
|
||||
@@ -1546,7 +1546,7 @@ export function registerTerminalActions() {
|
||||
const terminalGroupService = accessor.get(ITerminalGroupService);
|
||||
await terminalService.doWithActiveInstance(async t => {
|
||||
const cwd = await getCwdForSplit(terminalService.configHelper, t);
|
||||
const instance = await terminalService.splitInstance(t, { cwd });
|
||||
const instance = await terminalService.createTerminal({ instanceToSplit: t, cwd });
|
||||
if (instance?.target !== TerminalLocation.Editor) {
|
||||
await terminalGroupService.showPanel(true);
|
||||
}
|
||||
@@ -1613,7 +1613,7 @@ export function registerTerminalActions() {
|
||||
const activeInstance = terminalService.activeInstance;
|
||||
if (activeInstance) {
|
||||
const cwd = await getCwdForSplit(terminalService.configHelper, activeInstance);
|
||||
await terminalService.splitInstance(activeInstance, { cwd });
|
||||
await terminalService.createTerminal({ instanceToSplit: activeInstance, cwd });
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -2029,7 +2029,7 @@ export function refreshTerminalActions(detectedProfiles: ITerminalProfile[]) {
|
||||
const activeInstance = terminalService.activeInstance;
|
||||
if (activeInstance) {
|
||||
const cwd = await getCwdForSplit(terminalService.configHelper, activeInstance);
|
||||
await terminalService.splitInstance(activeInstance, options?.config, cwd);
|
||||
await terminalService.createTerminal({ instanceToSplit: activeInstance, config: options?.config, cwd });
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,9 +11,9 @@ import { MenuRegistry, MenuId, IMenuActionOptions, MenuItemAction, IMenu } from
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { ContextKeyAndExpr, ContextKeyEqualsExpr, ContextKeyExpr, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { ICreateTerminalOptions, IExtensionTerminalProfile, ITerminalProfile, TerminalLocation, TerminalSettingId } from 'vs/platform/terminal/common/terminal';
|
||||
import { IExtensionTerminalProfile, ITerminalProfile, TerminalLocation, TerminalSettingId } from 'vs/platform/terminal/common/terminal';
|
||||
import { ResourceContextKey } from 'vs/workbench/common/resources';
|
||||
import { ITerminalService } from 'vs/workbench/contrib/terminal/browser/terminal';
|
||||
import { ICreateTerminalOptions, ITerminalService } from 'vs/workbench/contrib/terminal/browser/terminal';
|
||||
import { TerminalCommandId, TERMINAL_VIEW_ID } from 'vs/workbench/contrib/terminal/common/terminal';
|
||||
import { TerminalContextKeys, TerminalContextKeyStrings } from 'vs/workbench/contrib/terminal/common/terminalContextKey';
|
||||
import { terminalStrings } from 'vs/workbench/contrib/terminal/common/terminalStrings';
|
||||
|
||||
@@ -23,7 +23,7 @@ import { ILabelService } from 'vs/platform/label/common/label';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { IKeyMods, IPickOptions, IQuickInputButton, IQuickInputService, IQuickPickItem, IQuickPickSeparator } from 'vs/platform/quickinput/common/quickInput';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { ICreateContributedTerminalProfileOptions, ICreateTerminalOptions, IExtensionTerminalProfile, IShellLaunchConfig, ITerminalLaunchError, ITerminalProfile, ITerminalProfileObject, ITerminalProfileType, ITerminalsLayoutInfo, ITerminalsLayoutInfoById, TerminalLocation, TerminalSettingId, TerminalSettingPrefix } from 'vs/platform/terminal/common/terminal';
|
||||
import { ICreateContributedTerminalProfileOptions, IExtensionTerminalProfile, IShellLaunchConfig, ITerminalLaunchError, ITerminalProfile, ITerminalProfileObject, ITerminalProfileType, ITerminalsLayoutInfo, ITerminalsLayoutInfoById, TerminalLocation, TerminalSettingId, TerminalSettingPrefix } from 'vs/platform/terminal/common/terminal';
|
||||
import { registerTerminalDefaultProfileConfiguration } from 'vs/platform/terminal/common/terminalPlatformConfiguration';
|
||||
import { iconForeground } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { IconDefinition } from 'vs/platform/theme/common/iconRegistry';
|
||||
@@ -31,7 +31,7 @@ import { ColorScheme } from 'vs/platform/theme/common/theme';
|
||||
import { IThemeService, Themable, ThemeIcon } from 'vs/platform/theme/common/themeService';
|
||||
import { VirtualWorkspaceContext } from 'vs/workbench/browser/contextkeys';
|
||||
import { IEditableData, IViewsService } from 'vs/workbench/common/views';
|
||||
import { IRemoteTerminalService, IRequestAddInstanceToGroupEvent, ITerminalEditorService, ITerminalExternalLinkProvider, ITerminalFindHost, ITerminalGroup, ITerminalGroupService, ITerminalInstance, ITerminalInstanceHost, ITerminalInstanceService, ITerminalProfileProvider, ITerminalService, TerminalConnectionState } from 'vs/workbench/contrib/terminal/browser/terminal';
|
||||
import { ICreateTerminalOptions, IRemoteTerminalService, IRequestAddInstanceToGroupEvent, ITerminalEditorService, ITerminalExternalLinkProvider, ITerminalFindHost, ITerminalGroup, ITerminalGroupService, ITerminalInstance, ITerminalInstanceHost, ITerminalInstanceService, ITerminalProfileProvider, ITerminalService, TerminalConnectionState } from 'vs/workbench/contrib/terminal/browser/terminal';
|
||||
import { refreshTerminalActions } from 'vs/workbench/contrib/terminal/browser/terminalActions';
|
||||
import { TerminalConfigHelper } from 'vs/workbench/contrib/terminal/browser/terminalConfigHelper';
|
||||
import { TerminalEditor } from 'vs/workbench/contrib/terminal/browser/terminalEditor';
|
||||
@@ -415,7 +415,7 @@ export class TerminalService implements ITerminalService {
|
||||
}
|
||||
} else {
|
||||
// add split terminals to this group
|
||||
await this.splitInstance(terminalInstance, { attachPersistentProcess: terminalLayout.terminal! });
|
||||
await this.createTerminal({ config: { attachPersistentProcess: terminalLayout.terminal! }, instanceToSplit: terminalInstance },);
|
||||
}
|
||||
}
|
||||
const activeInstance = this.instances.find(t => {
|
||||
@@ -645,47 +645,6 @@ export class TerminalService implements ITerminalService {
|
||||
}
|
||||
}
|
||||
|
||||
async splitInstance(instanceToSplit: ITerminalInstance, shell?: IShellLaunchConfig, cwd?: string | URI): Promise<ITerminalInstance> {
|
||||
const shellLaunchConfig = this._convertProfileToShellLaunchConfig(shell);
|
||||
|
||||
const contributedDefaultProfile = await this._getContributedDefaultProfile(shellLaunchConfig);
|
||||
if (contributedDefaultProfile) {
|
||||
await this._createContributedTerminalProfile(contributedDefaultProfile.extensionIdentifier, contributedDefaultProfile.id, { isSplitTerminal: true, icon: contributedDefaultProfile.icon, color: contributedDefaultProfile.color });
|
||||
return this._terminalGroupService.instances[this._terminalGroupService.instances.length - 1];
|
||||
}
|
||||
|
||||
// Use the URI from the base instance if it exists, this will correctly split local terminals
|
||||
if (typeof shellLaunchConfig.cwd !== 'object' && typeof instanceToSplit.shellLaunchConfig.cwd === 'object') {
|
||||
shellLaunchConfig.cwd = URI.from({
|
||||
scheme: instanceToSplit.shellLaunchConfig.cwd.scheme,
|
||||
path: shellLaunchConfig.cwd || instanceToSplit.shellLaunchConfig.cwd.path
|
||||
});
|
||||
this._evaluateLocalCwd(shellLaunchConfig);
|
||||
}
|
||||
|
||||
// Handle editor terminals
|
||||
let instance: ITerminalInstance;
|
||||
switch (instanceToSplit.target) {
|
||||
case TerminalLocation.Editor:
|
||||
instance = this._terminalEditorService.splitInstance(instanceToSplit, shellLaunchConfig);
|
||||
break;
|
||||
case TerminalLocation.TerminalView:
|
||||
default:
|
||||
const group = this._terminalGroupService.getGroupForInstance(instanceToSplit);
|
||||
if (!group) {
|
||||
throw new Error(`Cannot split a terminal without a group ${instanceToSplit}`);
|
||||
}
|
||||
instance = group.split(shellLaunchConfig);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (instanceToSplit.target !== TerminalLocation.Editor) {
|
||||
this._terminalGroupService.groups.forEach((g, i) => g.setVisible(i === this._terminalGroupService.activeGroupIndex));
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
moveToEditor(source: ITerminalInstance): void {
|
||||
if (source.target === TerminalLocation.Editor) {
|
||||
return;
|
||||
@@ -964,7 +923,7 @@ export class TerminalService implements ITerminalService {
|
||||
} else {
|
||||
if (keyMods?.alt && activeInstance) {
|
||||
// create split, only valid if there's an active instance
|
||||
instance = await this.splitInstance(activeInstance, value.profile, cwd);
|
||||
instance = await this.createTerminal({ instanceToSplit: activeInstance, config: value.profile });
|
||||
} else {
|
||||
instance = await this.createTerminal({ target: this.configHelper.config.defaultLocation, config: value.profile, cwd });
|
||||
}
|
||||
@@ -1129,33 +1088,23 @@ export class TerminalService implements ITerminalService {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
private _optionsAreBasic(options?: ICreateTerminalOptions): boolean {
|
||||
if (!options) {
|
||||
return true;
|
||||
} else if (Object.entries(options).length > 2) {
|
||||
return false;
|
||||
}
|
||||
return Array.from(Object.keys(options)).filter(k => k !== 'target' && k !== 'forceSplit').length === 0;
|
||||
}
|
||||
|
||||
async createTerminal(options?: ICreateTerminalOptions): Promise<ITerminalInstance> {
|
||||
const config = options?.config;
|
||||
const shellLaunchConfig = config && 'extensionIdentifier' in config
|
||||
? {}
|
||||
: this._convertProfileToShellLaunchConfig(config || {});
|
||||
const shellLaunchConfig = config && 'extensionIdentifier' in config ? {} : this._convertProfileToShellLaunchConfig(config || {});
|
||||
|
||||
// Get the contributed profile if it was provided
|
||||
let contributedProfile = config && 'extensionIdentifier' in config ? config : undefined;
|
||||
|
||||
// Get the default profile as a contributed profile if it exists
|
||||
if (!contributedProfile && this._optionsAreBasic(options)) {
|
||||
if (!contributedProfile && (!options || !options.config)) {
|
||||
contributedProfile = await this._getContributedDefaultProfile(shellLaunchConfig);
|
||||
}
|
||||
|
||||
// Launch the contributed profile
|
||||
if (contributedProfile) {
|
||||
await this._createContributedTerminalProfile(contributedProfile.extensionIdentifier, contributedProfile.id, {
|
||||
isSplitTerminal: options?.forceSplit || false,
|
||||
isSplitTerminal: options?.forceSplit || !!options?.instanceToSplit,
|
||||
icon: contributedProfile.icon,
|
||||
target: options?.target
|
||||
});
|
||||
@@ -1169,6 +1118,14 @@ export class TerminalService implements ITerminalService {
|
||||
shellLaunchConfig.cwd = options.cwd;
|
||||
}
|
||||
|
||||
// Use the URI from the base instance if it exists, this will correctly split local terminals
|
||||
if (options?.instanceToSplit && typeof shellLaunchConfig.cwd !== 'object' && typeof options.instanceToSplit.shellLaunchConfig.cwd === 'object') {
|
||||
shellLaunchConfig.cwd = URI.from({
|
||||
scheme: options.instanceToSplit.shellLaunchConfig.cwd.scheme,
|
||||
path: shellLaunchConfig.cwd || options.instanceToSplit.shellLaunchConfig.cwd.path
|
||||
});
|
||||
}
|
||||
|
||||
if (!shellLaunchConfig.customPtyImplementation && !this.isProcessSupportRegistered) {
|
||||
throw new Error('Could not create terminal when process support is not registered');
|
||||
}
|
||||
@@ -1185,14 +1142,27 @@ export class TerminalService implements ITerminalService {
|
||||
|
||||
let instance: ITerminalInstance;
|
||||
const target = options?.target || this.configHelper.config.defaultLocation;
|
||||
if (target === TerminalLocation.Editor) {
|
||||
instance = this._terminalInstanceService.createInstance(shellLaunchConfig, undefined, options?.resource);
|
||||
instance.target = TerminalLocation.Editor;
|
||||
this._terminalEditorService.openEditor(instance, options?.forceSplit);
|
||||
if (options?.instanceToSplit) {
|
||||
if (target === TerminalLocation.Editor || options?.instanceToSplit?.target === TerminalLocation.Editor) {
|
||||
instance = this._terminalEditorService.splitInstance(options.instanceToSplit, shellLaunchConfig);
|
||||
} else {
|
||||
const group = this._terminalGroupService.getGroupForInstance(options.instanceToSplit);
|
||||
if (!group) {
|
||||
throw new Error(`Cannot split a terminal without a group ${options.instanceToSplit}`);
|
||||
}
|
||||
instance = group.split(shellLaunchConfig);
|
||||
this._terminalGroupService.groups.forEach((g, i) => g.setVisible(i === this._terminalGroupService.activeGroupIndex));
|
||||
}
|
||||
} else {
|
||||
// TODO: pass resource?
|
||||
const group = this._terminalGroupService.createGroup(shellLaunchConfig);
|
||||
instance = group.terminalInstances[0];
|
||||
if (target === TerminalLocation.Editor) {
|
||||
instance = this._terminalInstanceService.createInstance(shellLaunchConfig, undefined, options?.resource);
|
||||
instance.target = TerminalLocation.Editor;
|
||||
this._terminalEditorService.openEditor(instance, options?.forceSplit || !!options?.instanceToSplit);
|
||||
} else {
|
||||
// TODO: pass resource?
|
||||
const group = this._terminalGroupService.createGroup(shellLaunchConfig);
|
||||
instance = group.terminalInstances[0];
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ export class TerminalTabList extends WorkbenchList<ITerminalInstance> {
|
||||
// unless multi-selection is in progress
|
||||
this.onMouseClick(async e => {
|
||||
if (e.browserEvent.altKey && e.element) {
|
||||
await this._terminalService.splitInstance(e.element);
|
||||
await this._terminalService.createTerminal({ instanceToSplit: e.element });
|
||||
} else if (this._getFocusMode() === 'singleClick') {
|
||||
if (this.getSelection().length <= 1) {
|
||||
e.element?.focus(true);
|
||||
@@ -459,7 +459,7 @@ class TerminalTabsRenderer implements IListRenderer<ITerminalInstance, ITerminal
|
||||
// If the instance is within the selection, split all selected
|
||||
const actions = [
|
||||
new Action(TerminalCommandId.SplitInstance, terminalStrings.split.short, ThemeIcon.asClassName(Codicon.splitHorizontal), true, async () => {
|
||||
this._runForSelectionOrInstance(instance, e => this._terminalService.splitInstance(e));
|
||||
this._runForSelectionOrInstance(instance, e => this._terminalService.createTerminal({ instanceToSplit: e }));
|
||||
}),
|
||||
new Action(TerminalCommandId.KillInstance, terminalStrings.kill.short, ThemeIcon.asClassName(Codicon.trashcan), true, async () => {
|
||||
this._runForSelectionOrInstance(instance, e => e.dispose());
|
||||
|
||||
@@ -14,7 +14,7 @@ import { IThemeService, IColorTheme, registerThemingParticipant, ICssStyleCollec
|
||||
import { switchTerminalActionViewItemSeparator, switchTerminalShowTabsTitle } from 'vs/workbench/contrib/terminal/browser/terminalActions';
|
||||
import { TERMINAL_BACKGROUND_COLOR, TERMINAL_BORDER_COLOR, TERMINAL_DRAG_AND_DROP_BACKGROUND, TERMINAL_TAB_ACTIVE_BORDER } from 'vs/workbench/contrib/terminal/common/terminalColorRegistry';
|
||||
import { INotificationService, IPromptChoice, Severity } from 'vs/platform/notification/common/notification';
|
||||
import { ITerminalGroupService, ITerminalInstance, ITerminalService, TerminalConnectionState } from 'vs/workbench/contrib/terminal/browser/terminal';
|
||||
import { ICreateTerminalOptions, ITerminalGroupService, ITerminalInstance, ITerminalService, TerminalConnectionState } from 'vs/workbench/contrib/terminal/browser/terminal';
|
||||
import { ViewPane, IViewPaneOptions } from 'vs/workbench/browser/parts/views/viewPane';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
@@ -23,7 +23,7 @@ import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||
import { PANEL_BACKGROUND, SIDE_BAR_BACKGROUND, EDITOR_DRAG_AND_DROP_BACKGROUND } from 'vs/workbench/common/theme';
|
||||
import { IMenu, IMenuService, MenuId, MenuItemAction } from 'vs/platform/actions/common/actions';
|
||||
import { ITerminalProfileResolverService, TerminalCommandId } from 'vs/workbench/contrib/terminal/common/terminal';
|
||||
import { TerminalSettingId, ITerminalProfile, TerminalLocation, ICreateTerminalOptions } from 'vs/platform/terminal/common/terminal';
|
||||
import { TerminalSettingId, ITerminalProfile, TerminalLocation } from 'vs/platform/terminal/common/terminal';
|
||||
import { ActionViewItem, SelectActionViewItem } from 'vs/base/browser/ui/actionbar/actionViewItems';
|
||||
import { ITerminalContributionService } from 'vs/workbench/contrib/terminal/common/terminalExtensionPoints';
|
||||
import { attachSelectBoxStyler, attachStylerCallback } from 'vs/platform/theme/common/styler';
|
||||
@@ -183,7 +183,7 @@ export class TerminalViewPane extends ViewPane {
|
||||
run: async () => {
|
||||
const instance = this._terminalGroupService.activeInstance;
|
||||
if (instance) {
|
||||
const newInstance = await this._terminalService.splitInstance(instance);
|
||||
const newInstance = await this._terminalService.createTerminal({ instanceToSplit: instance, forceSplit: true });
|
||||
return newInstance?.focusWhenReady();
|
||||
}
|
||||
return;
|
||||
|
||||
@@ -126,9 +126,9 @@ import { SideBySideEditor } from 'vs/workbench/browser/parts/editor/sideBySideEd
|
||||
import { IEnterWorkspaceResult, IRecent, IRecentlyOpened, IWorkspaceFolderCreationData, IWorkspaceIdentifier, IWorkspacesService } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { IWorkspaceTrustManagementService, IWorkspaceTrustRequestService } from 'vs/platform/workspace/common/workspaceTrust';
|
||||
import { TestWorkspaceTrustManagementService, TestWorkspaceTrustRequestService } from 'vs/workbench/services/workspaces/test/common/testWorkspaceTrustService';
|
||||
import { ICreateTerminalOptions, IShellLaunchConfig, ITerminalChildProcess, ITerminalProfile, ITerminalsLayoutInfo, ITerminalsLayoutInfoById, TerminalLocation, TerminalShellType } from 'vs/platform/terminal/common/terminal';
|
||||
import { IShellLaunchConfig, ITerminalChildProcess, ITerminalProfile, ITerminalsLayoutInfo, ITerminalsLayoutInfoById, TerminalLocation, TerminalShellType } from 'vs/platform/terminal/common/terminal';
|
||||
import { IProcessDetails, ISetTerminalLayoutInfoArgs } from 'vs/platform/terminal/common/terminalProcess';
|
||||
import { ITerminalInstance, ITerminalInstanceService } from 'vs/workbench/contrib/terminal/browser/terminal';
|
||||
import { ICreateTerminalOptions, ITerminalInstance, ITerminalInstanceService } from 'vs/workbench/contrib/terminal/browser/terminal';
|
||||
import { isArray } from 'vs/base/common/types';
|
||||
import { ILocalTerminalService, IShellLaunchConfigResolveOptions, ITerminalProfileResolverService } from 'vs/workbench/contrib/terminal/common/terminal';
|
||||
import { EditorResolverService } from 'vs/workbench/services/editor/browser/editorResolverService';
|
||||
|
||||
Reference in New Issue
Block a user