Skip to content

Commit

Permalink
fix: update monaco keybindings after keybinding changed (#2257)
Browse files Browse the repository at this point in the history
* fix: update monaco keybindings after keybinding changed

* chore: update yarn.lock
  • Loading branch information
erha19 authored Feb 9, 2023
1 parent 55d4729 commit 670f4f4
Show file tree
Hide file tree
Showing 6 changed files with 273 additions and 215 deletions.
7 changes: 6 additions & 1 deletion packages/core-browser/src/keybinding/keybinding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export enum KeybindingScope {
}

// ref: https://github.com/Microsoft/vscode/blob/97fc588e65bedcb1113baeddd2f67237e52c8c63/src/vs/platform/keybinding/common/keybindingsRegistry.ts#L56
// 快捷键第一优先级,在开天中将对该值 * 100 作为快捷键的优先级参数 priority
// 快捷键第一优先级,将对该值 * 100 作为快捷键的优先级参数 priority
export enum KeybindingWeight {
Default = 0, // 不传入 priority 则默认为 0
EditorCore = 1,
Expand Down Expand Up @@ -161,6 +161,7 @@ export interface KeybindingRegistry {
isPseudoCommand(commandId: string): boolean;
resetKeybindings(): void;
onKeybindingsChanged: Event<{ affectsCommands: string[] }>;
getKeybindingByScope(scope: KeybindingScope): Keybinding[];
}

export const keybindingServicePath = '/services/keybindings';
Expand Down Expand Up @@ -903,6 +904,10 @@ export class KeybindingRegistryImpl implements KeybindingRegistry, KeybindingSer
}
return false;
}

getKeybindingByScope(scope: KeybindingScope) {
return this.keymaps[scope];
}
}

export const NO_KEYBINDING_NAME = 'no_keybinding';
Loading

0 comments on commit 670f4f4

Please sign in to comment.