提交 9003dbc3 编写于 作者: A Alex Dima

Add IKeybindingService.resolveUserBinding

上级 0262e475
......@@ -416,6 +416,10 @@ export class StandaloneKeybindingService extends AbstractKeybindingService {
);
return new USLayoutResolvedKeybinding(keybinding, OS);
}
public resolveUserBinding(userBinding: string): ResolvedKeybinding[] {
return [];
}
}
export class SimpleConfigurationService implements IConfigurationService {
......
......@@ -64,6 +64,7 @@ export abstract class AbstractKeybindingService implements IKeybindingService {
protected abstract _getResolver(): KeybindingResolver;
public abstract resolveKeybinding(keybinding: Keybinding): ResolvedKeybinding[];
public abstract resolveKeyboardEvent(keyboardEvent: IKeyboardEvent): ResolvedKeybinding;
public abstract resolveUserBinding(userBinding: string): ResolvedKeybinding[];
public getDefaultKeybindings(): string {
return '';
......
......@@ -51,6 +51,8 @@ export interface IKeybindingService {
resolveKeyboardEvent(keyboardEvent: IKeyboardEvent): ResolvedKeybinding;
resolveUserBinding(userBinding: string): ResolvedKeybinding[];
/**
* Resolve and dispatch `keyboardEvent`, but do not invoke the command or change inner state.
*/
......
......@@ -57,6 +57,10 @@ suite('AbstractKeybindingService', () => {
return this.resolveKeybinding(keybinding)[0];
}
public resolveUserBinding(userBinding: string): ResolvedKeybinding[] {
return [];
}
public testDispatch(kb: number): boolean {
const keybinding = createSimpleKeybinding(kb, OS);
return this._dispatch({
......
......@@ -92,6 +92,10 @@ export class MockKeybindingService implements IKeybindingService {
return this.resolveKeybinding(keybinding)[0];
}
public resolveUserBinding(userBinding: string): ResolvedKeybinding[] {
return [];
}
public lookupKeybindings(commandId: string): ResolvedKeybinding[] {
return [];
}
......
......@@ -363,6 +363,11 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService {
return this._keyboardMapper.resolveKeyboardEvent(keyboardEvent);
}
public resolveUserBinding(userBinding: string): ResolvedKeybinding[] {
const [firstPart, chordPart] = KeybindingIO._readUserBinding(userBinding);
return this._keyboardMapper.resolveUserBinding(firstPart, chordPart);
}
private _handleKeybindingsExtensionPointUser(isBuiltin: boolean, keybindings: ContributedKeyBinding | ContributedKeyBinding[], collector: ExtensionMessageCollector): boolean {
if (isContributedKeyBindingsArray(keybindings)) {
let commandAdded = false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册