Merge from vscode dbe62be3266ffb6772a7f3db0bf61d63f4aa7f65 (#9337)

This commit is contained in:
Anthony Dresser
2020-02-26 00:23:48 -08:00
committed by GitHub
parent d2892ff78b
commit 067fcc8dfb
42 changed files with 384 additions and 409 deletions

View File

@@ -35,6 +35,10 @@ export abstract class AbstractKeybindingService extends Disposable implements IK
private _currentChordChecker: IntervalTimer;
private _currentChordStatusMessage: IDisposable | null;
public get inChordMode(): boolean {
return !!this._currentChord;
}
constructor(
private _contextKeyService: IContextKeyService,
protected _commandService: ICommandService,

View File

@@ -50,6 +50,8 @@ export const IKeybindingService = createDecorator<IKeybindingService>('keybindin
export interface IKeybindingService {
_serviceBrand: undefined;
readonly inChordMode: boolean;
onDidUpdateKeybindings: Event<IKeybindingEvent>;
/**

View File

@@ -11,7 +11,10 @@ import { ResolvedKeybindingItem } from 'vs/platform/keybinding/common/resolvedKe
import { keys } from 'vs/base/common/map';
export interface IResolveResult {
/** Whether the resolved keybinding is entering a chord */
enterChord: boolean;
/** Whether the resolved keybinding is leaving (and executing) a chord */
leaveChord: boolean;
commandId: string | null;
commandArgs: any;
bubble: boolean;
@@ -285,6 +288,7 @@ export class KeybindingResolver {
if (currentChord === null && result.keypressParts.length > 1 && result.keypressParts[1] !== null) {
return {
enterChord: true,
leaveChord: false,
commandId: null,
commandArgs: null,
bubble: false
@@ -293,6 +297,7 @@ export class KeybindingResolver {
return {
enterChord: false,
leaveChord: result.keypressParts.length > 1,
commandId: result.command,
commandArgs: result.commandArgs,
bubble: result.bubble

View File

@@ -71,6 +71,8 @@ export class MockContextKeyService implements IContextKeyService {
export class MockKeybindingService implements IKeybindingService {
public _serviceBrand: undefined;
public readonly inChordMode: boolean = false;
public get onDidUpdateKeybindings(): Event<IKeybindingEvent> {
return Event.None;
}