Skip to content

Commit

Permalink
Rename command describeBindings to searchBindings
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenguh committed Jun 16, 2021
1 parent 824b78a commit e9d2998
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
},
{
"key": "ctrl+h",
"command": "whichkey.describeBindings",
"command": "whichkey.searchBindings",
"when": "whichkeyVisible"
}
],
Expand Down Expand Up @@ -269,9 +269,9 @@
},
{
"key": "?",
"name": "Describe keybindings",
"name": "Search keybindings",
"type": "command",
"command": "whichkey.describeBindings"
"command": "whichkey.searchBindings"
},
{
"key": ".",
Expand Down
14 changes: 7 additions & 7 deletions src/commandRelay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ export interface KeybindingArgs {
export class CommandRelay {
private keyEmitter: EventEmitter<KeybindingArgs>;
private zenModeEmitter: EventEmitter<void>;
private describeBindingEmitter: EventEmitter<void>;
private searchBindingsEmitter: EventEmitter<void>;

constructor() {
this.keyEmitter = new EventEmitter<KeybindingArgs>();
this.zenModeEmitter = new EventEmitter<void>();
this.describeBindingEmitter = new EventEmitter<void>();
this.searchBindingsEmitter = new EventEmitter<void>();
}

triggerKey(key: string | KeybindingArgs): void {
Expand All @@ -35,17 +35,17 @@ export class CommandRelay {
return this.zenModeEmitter.event;
}

describeBindings(): void {
this.describeBindingEmitter.fire();
searchBindings(): void {
this.searchBindingsEmitter.fire();
}

get onDescribeBindings(): Event<void> {
return this.describeBindingEmitter.event;
get onDidSearchBindings(): Event<void> {
return this.searchBindingsEmitter.event;
}

dispose(): void {
this.keyEmitter.dispose();
this.zenModeEmitter.dispose();
this.describeBindingEmitter.dispose();
this.searchBindingsEmitter.dispose();
}
}
4 changes: 2 additions & 2 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export enum CommandKey {
Show = 'show',
Register = 'register',
Trigger = 'triggerKey',
DescribeBindings = 'describeBindings',
SearchBindings = 'searchBindings',
ShowTransient = 'showTransient',
RepeatRecent = 'repeatRecent',
RepeatMostRecent = 'repeatMostRecent',
Expand Down Expand Up @@ -44,7 +44,7 @@ export const Commands = {
Show: `${contributePrefix}.${CommandKey.Show}`,
Register: `${contributePrefix}.${CommandKey.Register}`,
Trigger: `${contributePrefix}.${CommandKey.Trigger}`,
DescribeBindings: `${contributePrefix}.${CommandKey.DescribeBindings}`,
SearchBindings: `${contributePrefix}.${CommandKey.SearchBindings}`,
ShowTransient: `${contributePrefix}.${CommandKey.ShowTransient}`,
RepeatRecent: `${contributePrefix}.${CommandKey.RepeatRecent}`,
RepeatMostRecent: `${contributePrefix}.${CommandKey.RepeatMostRecent}`,
Expand Down
2 changes: 1 addition & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function activate(context: ExtensionContext): void {
commands.registerCommand(Commands.Trigger, cmdRelay.triggerKey, cmdRelay),
commands.registerCommand(Commands.Register, registry.register, registry),
commands.registerCommand(Commands.Show, registry.show, registry),
commands.registerCommand(Commands.DescribeBindings, cmdRelay.describeBindings, cmdRelay),
commands.registerCommand(Commands.SearchBindings, cmdRelay.searchBindings, cmdRelay),
commands.registerCommand(Commands.ShowTransient, showTransientMenu.bind(registry, statusBar, cmdRelay)),
commands.registerCommand(Commands.RepeatRecent, registry.repeatRecent, registry),
commands.registerCommand(Commands.RepeatMostRecent, registry.repeatMostRecent, registry),
Expand Down
6 changes: 3 additions & 3 deletions src/menu/whichKeyMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ class WhichKeyMenu extends BaseWhichKeyMenu<WhichKeyMenuItem>{
constructor(statusBar: StatusBar, cmdRelay: CommandRelay, repeater?: WhichKeyRepeater, delay = 0) {
super(cmdRelay);
this.disposables.push(
cmdRelay.onDescribeBindings(this.onDescribeBindings, this)
cmdRelay.onDidSearchBindings(this.onDidSearchBindings, this)
);
this.statusBar = statusBar;
this.repeater = repeater;
this.delay = delay;
this.itemHistory = [];
}

private onDescribeBindings(): Promise<void> {
private onDidSearchBindings(): Promise<void> {
const items = createDescBindItems(this.items, this.itemHistory);
return showDescBindMenu(items, "Describe Keybindings");
return showDescBindMenu(items, "Search Keybindings");
}

protected async onItemNotMatch(value: string): Promise<void> {
Expand Down

0 comments on commit e9d2998

Please sign in to comment.