sussudio
Version:
An unofficial VS Code Internal API
45 lines (44 loc) • 2.27 kB
text/typescript
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ContextKeyExpression, IContext, IContextKeyService } from "../../contextkey/common/contextkey.mjs";
import { ResolvedKeybindingItem } from "./resolvedKeybindingItem.mjs";
export interface IResolveResult {
/** Whether the resolved keybinding is entering a multi chord */
enterMultiChord: boolean;
/** Whether the resolved keybinding is leaving (and executing) a multi chord keybinding */
leaveMultiChord: boolean;
commandId: string | null;
commandArgs: any;
bubble: boolean;
}
export declare class KeybindingResolver {
private readonly _log;
private readonly _defaultKeybindings;
private readonly _keybindings;
private readonly _defaultBoundCommands;
private readonly _map;
private readonly _lookupMap;
constructor(defaultKeybindings: ResolvedKeybindingItem[], overrides: ResolvedKeybindingItem[], log: (str: string) => void);
private static _isTargetedForRemoval;
/**
* Looks for rules containing "-commandId" and removes them.
*/
static handleRemovals(rules: ResolvedKeybindingItem[]): ResolvedKeybindingItem[];
private _addKeyPress;
private _addToLookupMap;
private _removeFromLookupMap;
/**
* Returns true if it is provable `a` implies `b`.
*/
static whenIsEntirelyIncluded(a: ContextKeyExpression | null | undefined, b: ContextKeyExpression | null | undefined): boolean;
getDefaultBoundCommands(): Map<string, boolean>;
getDefaultKeybindings(): readonly ResolvedKeybindingItem[];
getKeybindings(): readonly ResolvedKeybindingItem[];
lookupKeybindings(commandId: string): ResolvedKeybindingItem[];
lookupPrimaryKeybinding(commandId: string, context: IContextKeyService): ResolvedKeybindingItem | null;
resolve(context: IContext, currentChord: string | null, keypress: string): IResolveResult | null;
private _findCommand;
private static _contextMatchesRules;
}