Change:
The terminal commands and are used for both the panel buttons and the commands in the CP (that we do want to use the defaultLocation for). Not sure how to differentiate between them - don't think we want to duplicate the actions. let me know what you think
Let's wait until after is done since that will likely add target support to the create commands
Other reproes: Ctrl / Cmd J to open the panel - terminal editor is created focus the terminal editor, click the trash can on the panel , close the editor tab - a bunch of errors in the console

Discussion:
async run(accessor: ServicesAccessor) { const terminalService = accessor.get(ITerminalService); if (terminalService.isProcessSupportRegistered) { <del> const instance = terminalService.createTerminal(); </del> <ins> const instance = terminalService.createTerminal({ target: terminalService.configHelper.config.defaultLocation }); </ins> if (!instance) { return; }

} async run(accessor: ServicesAccessor) { const terminalService = accessor.get(ITerminalService); <del> const instance = terminalService.getActiveOrCreateInstance(); </del> <ins> const instance = terminalService.activeInstance || terminalService.createTerminal({ target: TerminalLocation.TerminalView }); </ins> if (!instance) { return; }

primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_BACKTICK, mac: { primary: KeyMod.WinCtrl | KeyMod.Shift | KeyCode.US_BACKTICK }, weight: KeybindingWeight.WorkbenchContrib <ins> }, description: { description: 'workbench.action.terminal.new', args: [{ name: 'eventOrOptions', schema: { type: 'object' } }] </ins> } }); } <del> async run(accessor: ServicesAccessor, event: unknown) { </del> <ins> async run(accessor: ServicesAccessor, eventOrOptions: MouseEvent | ICreateTerminalOptions | undefined) { </ins> const terminalService = accessor.get(ITerminalService); const terminalGroupService = accessor.get(ITerminalGroupService); const workspaceContextService = accessor.get(IWorkspaceContextService); const commandService = accessor.get(ICommandService); const folders = workspaceContextService.getWorkspace().folders; <del> if (event instanceof MouseEvent && (event.altKey || event.ctrlKey)) { </del> <ins> if (eventOrOptions && eventOrOptions instanceof MouseEvent && (eventOrOptions.altKey || eventOrOptions.ctrlKey)) { </ins> const activeInstance = terminalService.activeInstance; if (activeInstance) { const cwd = await getCwdForSplit(terminalService.configHelper, activeInstance);

} if (terminalService.isProcessSupportRegistered) { <ins> eventOrOptions = !eventOrOptions || eventOrOptions instanceof MouseEvent ? {} : eventOrOptions; eventOrOptions.target = eventOrOptions.target || terminalService.configHelper.config.defaultLocation; </ins> let instance: ITerminalInstance | undefined; if (folders.length <= 1) { // Allow terminal service to handle the path when there is only a // single root <del> instance = terminalService.createTerminal(); </del> <ins> instance = terminalService.createTerminal(eventOrOptions); </ins> } else { const options: IPickOptions<IQuickPickItem> = { placeHolder: localize('workbench.action.terminal.newWorkspacePlaceholder', "Select current working directory for new terminal")

// Don't create the instance if the workspace picker was canceled return; } <del> instance = terminalService.createTerminal( { cwd: workspace.uri } ); </del> <ins> eventOrOptions.cwd = workspace.uri; instance = terminalService.createTerminal(eventOrOptions); </ins> } terminalService.setActiveInstance(instance); }

} createTerminal(options?: ICreateTerminalOptions): ITerminalInstance { <ins> console.log(options); </ins> const shellLaunchConfig = this._convertProfileToShellLaunchConfig(options?.config || options); if (options?.cwd) {

this._evaluateLocalCwd(shellLaunchConfig); let instance: ITerminalInstance; <del> if (options?.target === TerminalLocation.Editor || this.configHelper.config.defaultLocation === TerminalLocation.Editor) { </del> <ins> if (options?.target === TerminalLocation.Editor) { </ins> instance = this.createInstance(shellLaunchConfig); instance.target = TerminalLocation.Editor; this._terminalEditorService.openEditor(instance);

if (this._terminalService.isProcessSupportRegistered) { if (this._terminalsInitialized) { if (!hadTerminals) { <del> this._terminalService.createTerminal(); </del> <ins> this._terminalService.createTerminal({ target: TerminalLocation.TerminalView }); </ins> } } else { this._terminalsInitialized = true;