mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
parent
7d4402a813
commit
66c08904ec
|
@ -401,7 +401,10 @@ export interface ICreateTerminalOptions {
|
|||
* Where to create the terminal, when not specified the default target will be used.
|
||||
*/
|
||||
target?: TerminalLocation;
|
||||
|
||||
/**
|
||||
* Create the editor terminal in beside the current editor.
|
||||
*/
|
||||
sideGroup?: boolean;
|
||||
/**
|
||||
* The terminal's resource, passed when the terminal has moved windows.
|
||||
*/
|
||||
|
|
|
@ -198,7 +198,7 @@ export interface ITerminalEditorService extends ITerminalInstanceHost, ITerminal
|
|||
/** Gets all _terminal editor_ instances. */
|
||||
readonly instances: readonly ITerminalInstance[];
|
||||
|
||||
openEditor(instance: ITerminalInstance): Promise<void>;
|
||||
openEditor(instance: ITerminalInstance, sideGroup?: boolean): Promise<void>;
|
||||
getOrCreateEditorInput(instance: ITerminalInstance | DeserializedTerminalEditorInput | URI): TerminalEditorInput;
|
||||
detachActiveEditorInstance(): ITerminalInstance;
|
||||
detachInstance(instance: ITerminalInstance): void;
|
||||
|
|
|
@ -241,6 +241,25 @@ export function registerTerminalActions() {
|
|||
}
|
||||
});
|
||||
|
||||
registerAction2(class extends Action2 {
|
||||
constructor() {
|
||||
super({
|
||||
id: TerminalCommandId.CreateTerminalEditorSide,
|
||||
title: { value: localize('workbench.action.terminal.createTerminalEditorSide', "Create Terminal in Editor Area to the Side"), original: 'Create Terminal in Editor Area to the Side' },
|
||||
f1: true,
|
||||
category,
|
||||
precondition: TerminalContextKeys.processSupported
|
||||
});
|
||||
}
|
||||
async run(accessor: ServicesAccessor) {
|
||||
const terminalService = accessor.get(ITerminalService);
|
||||
await terminalService.createTerminal({
|
||||
target: TerminalLocation.Editor,
|
||||
sideGroup: true
|
||||
}).focusWhenReady();
|
||||
}
|
||||
});
|
||||
|
||||
registerAction2(class extends Action2 {
|
||||
constructor() {
|
||||
super({
|
||||
|
|
|
@ -18,7 +18,7 @@ import { TerminalEditorInput } from 'vs/workbench/contrib/terminal/browser/termi
|
|||
import { DeserializedTerminalEditorInput } from 'vs/workbench/contrib/terminal/browser/terminalEditorSerializer';
|
||||
import { getInstanceFromResource, parseTerminalUri } from 'vs/workbench/contrib/terminal/browser/terminalUri';
|
||||
import { ILocalTerminalService, IOffProcessTerminalService } from 'vs/workbench/contrib/terminal/common/terminal';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorService, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
||||
import { ILifecycleService } from 'vs/workbench/services/lifecycle/common/lifecycle';
|
||||
|
||||
|
@ -158,14 +158,12 @@ export class TerminalEditorService extends Disposable implements ITerminalEditor
|
|||
this._onDidChangeActiveInstance.fire(this.activeInstance);
|
||||
}
|
||||
|
||||
async openEditor(instance: ITerminalInstance): Promise<void> {
|
||||
async openEditor(instance: ITerminalInstance, sideGroup: boolean = false): Promise<void> {
|
||||
const input = this.getOrCreateEditorInput(instance);
|
||||
const editorPane: IEditorPane | undefined = await this._editorService.openEditor(input, {
|
||||
pinned: true,
|
||||
forceReload: true
|
||||
},
|
||||
input.group
|
||||
);
|
||||
}, sideGroup ? SIDE_GROUP : input.group);
|
||||
input.setGroup(editorPane?.group);
|
||||
}
|
||||
|
||||
|
|
|
@ -1083,7 +1083,7 @@ export class TerminalService implements ITerminalService {
|
|||
if (target === TerminalLocation.Editor) {
|
||||
instance = this._terminalInstanceService.createInstance(shellLaunchConfig, undefined, options?.resource);
|
||||
instance.target = TerminalLocation.Editor;
|
||||
this._terminalEditorService.openEditor(instance);
|
||||
this._terminalEditorService.openEditor(instance, options?.sideGroup);
|
||||
} else {
|
||||
// TODO: pass resource?
|
||||
const group = this._terminalGroupService.createGroup(shellLaunchConfig);
|
||||
|
|
|
@ -388,6 +388,7 @@ export const enum TerminalCommandId {
|
|||
FocusPreviousPane = 'workbench.action.terminal.focusPreviousPane',
|
||||
ShowTabs = 'workbench.action.terminal.showTabs',
|
||||
CreateTerminalEditor = 'workbench.action.createTerminalEditor',
|
||||
CreateTerminalEditorSide = 'workbench.action.createTerminalEditorSide',
|
||||
FocusTabs = 'workbench.action.terminal.focusTabs',
|
||||
FocusNextPane = 'workbench.action.terminal.focusNextPane',
|
||||
ResizePaneLeft = 'workbench.action.terminal.resizePaneLeft',
|
||||
|
|
Loading…
Reference in a new issue