提交 2c445297 编写于 作者: S Sandeep Somavarapu

Fix #70077

上级 80e10b8c
......@@ -199,8 +199,10 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
}
defineWhenExpression(keybindingEntry: IKeybindingItemEntry): void {
this.selectEntry(keybindingEntry);
this._onDefineWhenExpression.fire(keybindingEntry);
if (keybindingEntry.keybindingItem.keybinding) {
this.selectEntry(keybindingEntry);
this._onDefineWhenExpression.fire(keybindingEntry);
}
}
updateKeybinding(keybindingEntry: IKeybindingItemEntry, key: string, when: string | undefined): Promise<any> {
......@@ -658,7 +660,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
private createDefineWhenExpressionAction(keybindingItemEntry: IKeybindingItemEntry): IAction {
return <IAction>{
label: localize('editWhen', "Change When Expression"),
enabled: true,
enabled: !!keybindingItemEntry.keybindingItem.keybinding,
id: KEYBINDINGS_EDITOR_COMMAND_DEFINE_WHEN,
run: () => this.defineWhenExpression(keybindingItemEntry)
};
......
......@@ -239,7 +239,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_E),
handler: (accessor, args: any) => {
const control = accessor.get(IEditorService).activeControl as IKeybindingsEditor;
if (control && control instanceof KeybindingsEditor) {
if (control && control instanceof KeybindingsEditor && control.activeKeybindingEntry.keybindingItem.keybinding) {
control.defineWhenExpression(control.activeKeybindingEntry);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册