提交 a1b811b8 编写于 作者: J Johannes Rieken

menu - use editor context if avialable, fallback to global

上级 ed0420e3
......@@ -21,7 +21,7 @@ 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 } from 'vs/editor/common/editorCommon';
import { IEditorAction, IEditor, isCommonCodeEditor } 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';
......@@ -276,7 +276,10 @@ export class CommandsHandler extends QuickOpenHandler {
const editorEntries = this.editorActionsToEntries(editorActions, searchValue);
// Other Actions
const menu = this.menuService.createMenu(MenuId.CommandPalette, this.contextKeyService);
const menu = isCommonCodeEditor(activeEditorControl)
? activeEditorControl.invokeWithinContext(accessor => this.menuService.createMenu(MenuId.CommandPalette, accessor.get(IContextKeyService)))
: this.menuService.createMenu(MenuId.CommandPalette, this.contextKeyService);
const menuActions = menu.getActions().reduce((r, [, actions]) => [...r, ...actions], <MenuItemAction[]>[]);
const commandEntries = this.menuItemActionsToEntries(menuActions, searchValue);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册