import { Event } from '@vscode-alt/monaco-editor/esm/vs/base/common/event'; import { IJSONSchema } from '@vscode-alt/monaco-editor/esm/vs/base/common/jsonSchema'; import { Keybinding, KeyCode, ResolvedKeybinding } from '@vscode-alt/monaco-editor/esm/vs/base/common/keyCodes'; import { IContextKeyServiceTarget } from '@vscode-alt/monaco-editor/esm/vs/platform/contextkey/common/contextkey'; import { IResolveResult } from '@vscode-alt/monaco-editor/esm/vs/platform/keybinding/common/keybindingResolver'; import { ResolvedKeybindingItem } from '@vscode-alt/monaco-editor/esm/vs/platform/keybinding/common/resolvedKeybindingItem'; import { IKeyboardEvent } from '@vscode-alt/monaco-editor/esm/vs/platform/keybinding/common/keybinding'; import { IKeybindingSource } from '../generated-model'; export interface IUserFriendlyKeybinding { key: string; command: string; args?: any; when?: string; } export interface IKeybindingEvent { source: IKeybindingSource; keybindings?: IUserFriendlyKeybinding[]; } export interface KeybindingsSchemaContribution { readonly onDidChange?: Event; getSchemaAdditions(): IJSONSchema[]; } export interface IKeybindingService { _serviceBrand: undefined; readonly inChordMode: boolean; onDidUpdateKeybindings: Event; /** * Returns none, one or many (depending on keyboard layout)! */ resolveKeybinding(keybinding: Keybinding): ResolvedKeybinding[]; resolveKeyboardEvent(keyboardEvent: IKeyboardEvent): ResolvedKeybinding; resolveUserBinding(userBinding: string): ResolvedKeybinding[]; /** * Resolve and dispatch `keyboardEvent` and invoke the command. */ dispatchEvent(e: IKeyboardEvent, target: IContextKeyServiceTarget): boolean; /** * Resolve and dispatch `keyboardEvent`, but do not invoke the command or change inner state. */ softDispatch(keyboardEvent: IKeyboardEvent, target: IContextKeyServiceTarget): IResolveResult | null; dispatchByUserSettingsLabel(userSettingsLabel: string, target: IContextKeyServiceTarget): void; /** * Look up keybindings for a command. * Use `lookupKeybinding` if you are interested in the preferred keybinding. */ lookupKeybindings(commandId: string): ResolvedKeybinding[]; /** * Look up the preferred (last defined) keybinding for a command. * @returns The preferred keybinding or null if the command is not bound. */ lookupKeybinding(commandId: string): ResolvedKeybinding | undefined; getDefaultKeybindingsContent(): string; getDefaultKeybindings(): readonly ResolvedKeybindingItem[]; getKeybindings(): readonly ResolvedKeybindingItem[]; customKeybindingsCount(): number; /** * Will the given key event produce a character that's rendered on screen, e.g. in a * text box. *Note* that the results of this function can be incorrect. */ mightProducePrintableCharacter(event: IKeyboardEvent): boolean; registerSchemaContribution(contribution: KeybindingsSchemaContribution): void; _dumpDebugInfo(): string; _dumpDebugInfoJSON(): string; }