提交 62640a53 编写于 作者: D Dirk Baeumer

Fixes #22057: Add alias support to commands

上级 1239cebb
......@@ -17,6 +17,7 @@ import Event from 'vs/base/common/event';
export interface ICommandAction {
id: string;
title: string;
alias?: string;
category?: string;
iconClass?: string;
}
......
......@@ -356,14 +356,17 @@ export class CommandsHandler extends QuickOpenHandler {
const label = action.item.category
? nls.localize('cat.title', "{0}: {1}", action.item.category, action.item.title)
: action.item.title;
const highlights = wordFilter(searchValue, label);
if (!highlights) {
continue;
if (label) {
const labelHighlights = wordFilter(searchValue, label);
const [keybind] = this.keybindingService.lookupKeybindings(action.item.id);
const keyLabel = keybind ? this.keybindingService.getLabelFor(keybind) : '';
const keyAriaLabel = keybind ? this.keybindingService.getAriaLabelFor(keybind) : '';
const alias = action.item.alias ? action.item.alias : null;
const aliasHighlights = alias ? wordFilter(searchValue, alias) : null;
if (labelHighlights || aliasHighlights) {
entries.push(this.instantiationService.createInstance(ActionCommandEntry, keyLabel, keyAriaLabel, label, alias, labelHighlights, aliasHighlights, action));
}
}
const [keybind] = this.keybindingService.lookupKeybindings(action.item.id);
const keyLabel = keybind ? this.keybindingService.getLabelFor(keybind) : '';
const keyAriaLabel = keybind ? this.keybindingService.getAriaLabelFor(keybind) : '';
entries.push(this.instantiationService.createInstance(ActionCommandEntry, keyLabel, keyAriaLabel, label, null, highlights, null, action));
}
return entries;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册