Add context to hotkeys manager
This commit is contained in:
parent
db795f3cb0
commit
c8052e0e0a
@ -18,7 +18,7 @@ export class HotkeysManager {
|
|||||||
|
|
||||||
if (!commandsManager) {
|
if (!commandsManager) {
|
||||||
log.warn(
|
log.warn(
|
||||||
'HotkeysManager instantiated without a commandsManager. Hotkeys will be unable to find and run commands.'
|
'[hotkeys] HotkeysManager instantiated without a commandsManager. Hotkeys will be unable to find and run commands.'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ export class HotkeysManager {
|
|||||||
*/
|
*/
|
||||||
registerHotkeys({ commandName, keys, label } = {}, extension) {
|
registerHotkeys({ commandName, keys, label } = {}, extension) {
|
||||||
if (!commandName) {
|
if (!commandName) {
|
||||||
log.warn(`No command was defined for hotkey "${keys}"`);
|
log.warn(`[hotkeys] No command was defined for hotkey "${keys}"`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,13 +156,13 @@ export class HotkeysManager {
|
|||||||
if (previouslyRegisteredDefinition) {
|
if (previouslyRegisteredDefinition) {
|
||||||
const previouslyRegisteredKeys = previouslyRegisteredDefinition.keys;
|
const previouslyRegisteredKeys = previouslyRegisteredDefinition.keys;
|
||||||
this._unbindHotkeys(commandName, previouslyRegisteredKeys);
|
this._unbindHotkeys(commandName, previouslyRegisteredKeys);
|
||||||
log.info(`Unbinding ${commandName} from ${previouslyRegisteredKeys}`);
|
log.info(`[hotkeys] Unbinding ${commandName} from ${previouslyRegisteredKeys}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set definition & bind
|
// Set definition & bind
|
||||||
this.hotkeyDefinitions[commandName] = { keys, label };
|
this.hotkeyDefinitions[commandName] = { keys, label };
|
||||||
this._bindHotkeys(commandName, keys);
|
this._bindHotkeys(commandName, keys);
|
||||||
log.info(`Binding ${commandName} to ${keys}`);
|
log.info(`[hotkeys] Binding ${commandName} to ${keys}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user