提交 63cbe996 编写于 作者: T t-amqi

Add context key and refine quickpick for terminal

上级 9b228747
......@@ -29,22 +29,34 @@ import { OpenNextRecentlyUsedEditorInGroupAction, OpenPreviousRecentlyUsedEditor
import { EDITOR_FONT_DEFAULTS } from 'vs/editor/common/config/editorOptions';
import { registerColors } from './terminalColorRegistry';
import { NavigateUpAction, NavigateDownAction, NavigateLeftAction, NavigateRightAction } from "vs/workbench/electron-browser/actions";
import { QUICKOPEN_ACTION_ID } from "vs/workbench/browser/parts/quickopen/quickopen";
import { QUICKOPEN_ACTION_ID, getQuickNavigateHandler } from "vs/workbench/browser/parts/quickopen/quickopen";
import { IQuickOpenRegistry, Extensions as QuickOpenExtensions, QuickOpenHandlerDescriptor } from 'vs/workbench/browser/quickopen';
import { Scope, IActionBarRegistry, Extensions as ActionBarExtensions } from 'vs/workbench/browser/actions';
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
const quickOpenRegistry = (<IQuickOpenRegistry>Registry.as(QuickOpenExtensions.Quickopen));
const inTerminalsPicker = 'inTerminalPicker';
quickOpenRegistry.registerQuickOpenHandler(
new QuickOpenHandlerDescriptor(
'vs/workbench/parts/terminal/browser/terminalQuickOpen',
'TerminalPickerHandler',
TERMINAL_PICKER_PREFIX,
null,
inTerminalsPicker,
nls.localize('quickOpen.terminal', "Show All Opened Terminals")
)
);
const quickOpenNavigateNextInTerminalPickerId = 'workbench.action.quickOpenNavigateNextInTerminalPicker';
CommandsRegistry.registerCommand(
quickOpenNavigateNextInTerminalPickerId, { handler: getQuickNavigateHandler(quickOpenNavigateNextInTerminalPickerId, true) });
const quickOpenNavigatePreviousInTerminalPickerId = 'workbench.action.quickOpenNavigatePreviousInTerminalPicker';
CommandsRegistry.registerCommand(
quickOpenNavigatePreviousInTerminalPickerId, { handler: getQuickNavigateHandler(quickOpenNavigatePreviousInTerminalPickerId, false) });
const registry = <IWorkbenchActionRegistry>Registry.as(ActionExtensions.WorkbenchActions);
registry.registerWorkbenchAction(new SyncActionDescriptor(QuickOpenTermAction, QuickOpenTermAction.ID, QuickOpenTermAction.LABEL), 'Quick Open Terminal');
const actionBarRegistry = Registry.as<IActionBarRegistry>(ActionBarExtensions.Actionbar);
......
......@@ -630,6 +630,8 @@ export class RenameTerminalAction extends Action {
if (name) {
terminalInstance.setTitle(name, false);
}
this.quickOpenService.show('term ');
});
}
}
......@@ -695,7 +697,7 @@ export class QuickOpenActionTermContributor extends ActionBarContributor {
export class QuickOpenTermAction extends Action {
public static ID = 'workbench.action.quickOpenTerm';
public static LABEL = nls.localize('quickOpenTerm', "Quick Open Terminal");
public static LABEL = nls.localize('quickOpenTerm', "Switch active terminal");
constructor(
id: string,
......@@ -734,9 +736,10 @@ export class RenameTerminalQuickOpenAction extends Action {
public run(): TPromise<any> {
const currentTerminal = this.terminalService.getActiveInstance();
this.terminalService.setActiveInstanceByIndex(parseInt(this._terminal.getLabel().split(':')[0], 10) - 1);
this.instantiationService.createInstance(RenameTerminalAction, RenameTerminalAction.ID, RenameTerminalAction.LABEL).run().then(result => {
this.quickOpenService.show(TERMINAL_PICKER_PREFIX, null);
});
this.instantiationService.createInstance(RenameTerminalAction, RenameTerminalAction.ID, RenameTerminalAction.LABEL).run()
.then(() => TPromise.timeout(50))
.then(result => this.quickOpenService.show(TERMINAL_PICKER_PREFIX, null));
this.terminalService.setActiveInstance(currentTerminal);
return TPromise.as(null);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册