diff --git a/src/vs/workbench/parts/terminal/browser/terminalQuickOpen.ts b/src/vs/workbench/parts/terminal/browser/terminalQuickOpen.ts index 7d67da472bf..10c109eefd7 100644 --- a/src/vs/workbench/parts/terminal/browser/terminalQuickOpen.ts +++ b/src/vs/workbench/parts/terminal/browser/terminalQuickOpen.ts @@ -15,8 +15,6 @@ import { QuickOpenHandler } from 'vs/workbench/browser/quickopen'; import { ITerminalService } from 'vs/workbench/parts/terminal/common/terminal'; import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; -export const TERMINAL_PICKER_PREFIX = 'term '; - export class TerminalEntry extends QuickOpenEntryGroup { constructor( @@ -95,7 +93,7 @@ export class TerminalPickerHandler extends QuickOpenHandler { e.setGroupLabel(lastCategory); } else { e.setShowBorder(false); - e.setGroupLabel(void 0); + e.setGroupLabel(null); } }); @@ -104,29 +102,17 @@ export class TerminalPickerHandler extends QuickOpenHandler { private getTerminals(): TerminalEntry[] { const termninalEntries: TerminalEntry[] = []; - const taskEntries: TerminalEntry[] = []; - const terminals = this.terminalService.terminalInstances; + const terminals = this.terminalService.getInstanceLabels(); terminals.forEach((terminal, index) => { const terminalsCategory = nls.localize('terminals', "Terminal"); - const taskCategory = nls.localize('task', "Task"); - if (terminal.title.indexOf('Task') >= 0) { - taskEntries.push(new TerminalEntry(nls.localize('terminalTitle', "{0}: {1}", index + 1, terminal.title), taskCategory, () => { - this.terminalService.showPanel(true).done(() => { - this.terminalService.setActiveInstance(terminal); - }, errors.onUnexpectedError); - })); - } else { - termninalEntries.push(new TerminalEntry(nls.localize('terminalTitle', "{0}: {1}", index + 1, terminal.title), terminalsCategory, () => { - this.terminalService.showPanel(true).done(() => { - this.terminalService.setActiveInstance(terminal); - }, errors.onUnexpectedError); - })); - } - - + termninalEntries.push(new TerminalEntry(terminal, terminalsCategory, () => { + this.terminalService.showPanel(true).done(() => { + this.terminalService.setActiveInstanceByIndex(parseInt(terminal.split(':')[0], 10) - 1); + }, errors.onUnexpectedError); + })); }); - return termninalEntries.concat(taskEntries); + return termninalEntries; } public getAutoFocus(searchValue: string, context: { model: IModel, quickNavigateConfiguration?: IQuickNavigateConfiguration }): IAutoFocus { diff --git a/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts b/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts index 32a87195409..e874414c89c 100644 --- a/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts +++ b/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts @@ -7,7 +7,6 @@ import 'vs/css!./media/scrollbar'; import 'vs/css!./media/terminal'; import 'vs/css!./media/xterm'; import 'vs/css!./media/widgets'; -import 'vs/workbench/parts/terminal/browser/terminalQuickOpen'; import * as debugActions from 'vs/workbench/parts/debug/browser/debugActions'; import * as nls from 'vs/nls'; import * as panel from 'vs/workbench/browser/panel'; @@ -33,15 +32,17 @@ import { NavigateUpAction, NavigateDownAction, NavigateLeftAction, NavigateRight import { QUICKOPEN_ACTION_ID } from "vs/workbench/browser/parts/quickopen/quickopen"; import { IQuickOpenRegistry, Extensions as QuickOpenExtensions, QuickOpenHandlerDescriptor } from 'vs/workbench/browser/quickopen'; +export const TERMINAL_PICKER_PREFIX = 'term '; +const terminalPickerContextKey = 'inTerminalPicker'; const quickOpenRegistry = (Registry.as(QuickOpenExtensions.Quickopen)); quickOpenRegistry.registerQuickOpenHandler( new QuickOpenHandlerDescriptor( 'vs/workbench/parts/terminal/browser/terminalQuickOpen', 'TerminalPickerHandler', - 'term ', - 'inTerminalPicker', - nls.localize('quickOpen.terminal', "Quickpick Terminal") + TERMINAL_PICKER_PREFIX, + terminalPickerContextKey, + nls.localize('quickOpen.terminal', "Show All Opened Terminals") ) ); diff --git a/src/vs/workbench/workbench.main.ts b/src/vs/workbench/workbench.main.ts index 9897e65e326..ca856f6cee6 100644 --- a/src/vs/workbench/workbench.main.ts +++ b/src/vs/workbench/workbench.main.ts @@ -69,6 +69,7 @@ import 'vs/workbench/parts/output/browser/output.contribution'; import 'vs/workbench/parts/output/browser/outputPanel'; // can be packaged separately import 'vs/workbench/parts/terminal/electron-browser/terminal.contribution'; +import 'vs/workbench/parts/terminal/browser/terminalQuickOpen'; import 'vs/workbench/parts/terminal/electron-browser/terminalPanel'; // can be packaged separately import 'vs/workbench/electron-browser/workbench';