Merge from vscode 91e99652cd5fcfc072387c64e151b435e39e8dcf (#6962)

This commit is contained in:
Anthony Dresser
2019-08-26 15:58:42 -07:00
committed by GitHub
parent edf470c8fa
commit 507bae90b7
103 changed files with 1743 additions and 1543 deletions

View File

@@ -46,6 +46,7 @@ import { attachStylerCallback, attachInputBoxStyler } from 'vs/platform/theme/co
import { IStorageService } from 'vs/platform/storage/common/storage';
import { InputBox, MessageType } from 'vs/base/browser/ui/inputbox/inputBox';
import { Emitter, Event } from 'vs/base/common/event';
import { MenuRegistry, MenuId, isIMenuItem } from 'vs/platform/actions/common/actions';
const $ = DOM.$;
@@ -489,11 +490,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
if (this.input) {
const input: KeybindingsEditorInput = this.input as KeybindingsEditorInput;
this.keybindingsEditorModel = await input.resolve();
const editorActionsLabels: Map<string, string> = EditorExtensionsRegistry.getEditorActions().reduce((editorActions, editorAction) => {
editorActions.set(editorAction.id, editorAction.label);
return editorActions;
}, new Map<string, string>());
await this.keybindingsEditorModel.resolve(editorActionsLabels);
await this.keybindingsEditorModel.resolve(this.getActionsLabels());
this.renderKeybindingsEntries(false, preserveFocus);
if (input.searchOptions) {
this.recordKeysAction.checked = input.searchOptions.recordKeybindings;
@@ -505,6 +502,19 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
}
}
private getActionsLabels(): Map<string, string> {
const actionsLabels: Map<string, string> = new Map<string, string>();
EditorExtensionsRegistry.getEditorActions().forEach(editorAction => actionsLabels.set(editorAction.id, editorAction.label));
for (const menuItem of MenuRegistry.getMenuItems(MenuId.CommandPalette)) {
if (isIMenuItem(menuItem)) {
const title = typeof menuItem.command.title === 'string' ? menuItem.command.title : menuItem.command.title.value;
const category = menuItem.command.category ? typeof menuItem.command.category === 'string' ? menuItem.command.category : menuItem.command.category.value : undefined;
actionsLabels.set(menuItem.command.id, category ? `${category}: ${title}` : title);
}
}
return actionsLabels;
}
private filterKeybindings(): void {
this.renderKeybindingsEntries(this.searchWidget.hasFocus());
this.delayedFilterLogging.trigger(() => this.reportFilteringUsed(this.searchWidget.getValue()));
@@ -716,7 +726,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
private createCopyCommandAction(keybinding: IKeybindingItemEntry): IAction {
return <IAction>{
label: localize('copyCommandLabel', "Copy Command"),
label: localize('copyCommandLabel', "Copy Command ID"),
enabled: true,
id: KEYBINDINGS_EDITOR_COMMAND_COPY_COMMAND,
run: () => this.copyKeybindingCommand(keybinding)