diff --git a/src/vs/workbench/parts/quickopen/browser/commandsHandler.ts b/src/vs/workbench/parts/quickopen/browser/commandsHandler.ts index babd5ed62e2..e127165fe58 100644 --- a/src/vs/workbench/parts/quickopen/browser/commandsHandler.ts +++ b/src/vs/workbench/parts/quickopen/browser/commandsHandler.ts @@ -20,14 +20,15 @@ import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actionRegistry'; import { Registry } from 'vs/platform/platform'; import { QuickOpenHandler, QuickOpenAction } from 'vs/workbench/browser/quickopen'; -import { IEditorAction, IEditor, isCommonCodeEditor } from 'vs/editor/common/editorCommon'; +import { IEditorAction, IEditor, isCommonCodeEditor, ICommonCodeEditor } from 'vs/editor/common/editorCommon'; import { matchesWords, matchesPrefix, matchesContiguousSubString, or } from 'vs/base/common/filters'; import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService'; -import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; +import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { IMessageService, Severity, IMessageWithAction } from 'vs/platform/message/common/message'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen'; +import { editorAction, EditorAction } from "vs/editor/common/editorCommonExtensions"; export const ALL_COMMANDS_PREFIX = '>'; export const EDITOR_COMMANDS_PREFIX = '$'; @@ -44,6 +45,30 @@ export class ShowAllCommandsAction extends QuickOpenAction { } } +@editorAction +class CommandPaletteEditorAction extends EditorAction { + + constructor() { + super({ + id: 'workbench.action.showCommands', + label: nls.localize('showCommands.label', "Command Palette..."), + alias: 'Command Palette', + precondition: null, + menuOpts: { + } + }); + } + + public run(accessor: ServicesAccessor, editor: ICommonCodeEditor): TPromise { + const quickOpenService = accessor.get(IQuickOpenService); + + // Show with prefix + quickOpenService.show(ALL_COMMANDS_PREFIX); + + return TPromise.as(null); + } +} + class BaseCommandEntry extends QuickOpenEntryGroup { private keyLabel: string; private keyAriaLabel: string; @@ -405,4 +430,4 @@ export class EditorCommandsHandler extends CommandsHandler { protected includeWorkbenchCommands(): boolean { return false; } -} +} \ No newline at end of file