Merge from vscode bead496a613e475819f89f08e9e882b841bc1fe8 (#14883)

* Merge from vscode bead496a613e475819f89f08e9e882b841bc1fe8

* Bump distro

* Upgrade GCC to 4.9 due to yarn install errors

* Update build image

* Fix bootstrap base url

* Bump distro

* Fix build errors

* Update source map file

* Disable checkbox for blocking migration issues (#15131)

* disable checkbox for blocking issues

* wip

* disable checkbox fixes

* fix strings

* Remove duplicate tsec command

* Default to off for tab color if settings not present

* re-skip failing tests

* Fix mocha error

* Bump sqlite version & fix notebooks search view

* Turn off esbuild warnings

* Update esbuild log level

* Fix overflowactionbar tests

* Fix ts-ignore in dropdown tests

* cleanup/fixes

* Fix hygiene

* Bundle in entire zone.js module

* Remove extra constructor param

* bump distro for web compile break

* bump distro for web compile break v2

* Undo log level change

* New distro

* Fix integration test scripts

* remove the "no yarn.lock changes" workflow

* fix scripts v2

* Update unit test scripts

* Ensure ads-kerberos2 updates in .vscodeignore

* Try fix unit tests

* Upload crash reports

* remove nogpu

* always upload crashes

* Use bash script

* Consolidate data/ext dir names

* Create in tmp directory

Co-authored-by: chlafreniere <hichise@gmail.com>
Co-authored-by: Christopher Suh <chsuh@microsoft.com>
Co-authored-by: chgagnon <chgagnon@microsoft.com>
This commit is contained in:
Karl Burtram
2021-04-27 14:01:59 -07:00
committed by GitHub
parent 7e1c0076ba
commit 867a963882
1817 changed files with 81812 additions and 50843 deletions

View File

@@ -5,7 +5,7 @@
import * as nls from 'vs/nls';
import * as arrays from 'vs/base/common/arrays';
import { IntervalTimer } from 'vs/base/common/async';
import { IntervalTimer, TimeoutTimer } from 'vs/base/common/async';
import { Emitter, Event } from 'vs/base/common/event';
import { KeyCode, Keybinding, ResolvedKeybinding } from 'vs/base/common/keyCodes';
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
@@ -35,6 +35,9 @@ export abstract class AbstractKeybindingService extends Disposable implements IK
private _currentChord: CurrentChord | null;
private _currentChordChecker: IntervalTimer;
private _currentChordStatusMessage: IDisposable | null;
private _currentSingleModifier: null | string;
private _currentSingleModifierClearTimeout: TimeoutTimer;
protected _logging: boolean;
public get inChordMode(): boolean {
@@ -53,6 +56,8 @@ export abstract class AbstractKeybindingService extends Disposable implements IK
this._currentChord = null;
this._currentChordChecker = new IntervalTimer();
this._currentChordStatusMessage = null;
this._currentSingleModifier = null;
this._currentSingleModifierClearTimeout = new TimeoutTimer();
this._logging = false;
}
@@ -166,30 +171,69 @@ export abstract class AbstractKeybindingService extends Disposable implements IK
public dispatchByUserSettingsLabel(userSettingsLabel: string, target: IContextKeyServiceTarget): void {
const keybindings = this.resolveUserBinding(userSettingsLabel);
if (keybindings.length >= 1) {
this._doDispatch(keybindings[0], target);
this._doDispatch(keybindings[0], target, /*isSingleModiferChord*/false);
}
}
protected _dispatch(e: IKeyboardEvent, target: IContextKeyServiceTarget): boolean {
return this._doDispatch(this.resolveKeyboardEvent(e), target);
return this._doDispatch(this.resolveKeyboardEvent(e), target, /*isSingleModiferChord*/false);
}
private _doDispatch(keybinding: ResolvedKeybinding, target: IContextKeyServiceTarget): boolean {
protected _singleModifierDispatch(e: IKeyboardEvent, target: IContextKeyServiceTarget): boolean {
const keybinding = this.resolveKeyboardEvent(e);
const [singleModifier,] = keybinding.getSingleModifierDispatchParts();
if (singleModifier !== null && this._currentSingleModifier === null) {
// we have a valid `singleModifier`, store it for the next keyup, but clear it in 300ms
this._log(`+ Storing single modifier for possible chord ${singleModifier}.`);
this._currentSingleModifier = singleModifier;
this._currentSingleModifierClearTimeout.cancelAndSet(() => {
this._log(`+ Clearing single modifier due to 300ms elapsed.`);
this._currentSingleModifier = null;
}, 300);
return false;
}
if (singleModifier !== null && singleModifier === this._currentSingleModifier) {
// bingo!
this._log(`/ Dispatching single modifier chord ${singleModifier} ${singleModifier}`);
this._currentSingleModifierClearTimeout.cancel();
this._currentSingleModifier = null;
return this._doDispatch(keybinding, target, /*isSingleModiferChord*/true);
}
this._currentSingleModifierClearTimeout.cancel();
this._currentSingleModifier = null;
return false;
}
private _doDispatch(keybinding: ResolvedKeybinding, target: IContextKeyServiceTarget, isSingleModiferChord = false): boolean {
let shouldPreventDefault = false;
if (keybinding.isChord()) {
console.warn('Unexpected keyboard event mapped to a chord');
return false;
}
const [firstPart,] = keybinding.getDispatchParts();
let firstPart: string | null = null; // the first keybinding i.e. Ctrl+K
let currentChord: string | null = null;// the "second" keybinding i.e. Ctrl+K "Ctrl+D"
if (isSingleModiferChord) {
const [dispatchKeyname,] = keybinding.getSingleModifierDispatchParts();
firstPart = dispatchKeyname;
currentChord = dispatchKeyname;
} else {
[firstPart,] = keybinding.getDispatchParts();
currentChord = this._currentChord ? this._currentChord.keypress : null;
}
if (firstPart === null) {
this._log(`\\ Keyboard event cannot be dispatched.`);
this._log(`\\ Keyboard event cannot be dispatched in keydown phase.`);
// cannot be dispatched, probably only modifier keys
return shouldPreventDefault;
}
const contextValue = this._contextKeyService.getContext(target);
const currentChord = this._currentChord ? this._currentChord.keypress : null;
const keypressLabel = keybinding.getLabel();
const resolveResult = this._getResolver().resolve(contextValue, currentChord, firstPart);

View File

@@ -69,10 +69,15 @@ export abstract class BaseResolvedKeybinding<T extends Modifiers> extends Resolv
return this._parts.map((keybinding) => this._getDispatchPart(keybinding));
}
public getSingleModifierDispatchParts(): (string | null)[] {
return this._parts.map((keybinding) => this._getSingleModifierDispatchPart(keybinding));
}
protected abstract _getLabel(keybinding: T): string | null;
protected abstract _getAriaLabel(keybinding: T): string | null;
protected abstract _getElectronAccelerator(keybinding: T): string | null;
protected abstract _getUserSettingsLabel(keybinding: T): string | null;
protected abstract _isWYSIWYG(keybinding: T): boolean;
protected abstract _getDispatchPart(keybinding: T): string | null;
protected abstract _getSingleModifierDispatchPart(keybinding: T): string | null;
}

View File

@@ -3,9 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { isNonEmptyArray } from 'vs/base/common/arrays';
import { MenuRegistry } from 'vs/platform/actions/common/actions';
import { CommandsRegistry, ICommandHandlerDescription } from 'vs/platform/commands/common/commands';
import { IContext, ContextKeyExpression, ContextKeyExprType } from 'vs/platform/contextkey/common/contextkey';
import { ResolvedKeybindingItem } from 'vs/platform/keybinding/common/resolvedKeybindingItem';
@@ -340,39 +337,6 @@ export class KeybindingResolver {
}
return rules.evaluate(context);
}
public static getAllUnboundCommands(boundCommands: Map<string, boolean>): string[] {
const unboundCommands: string[] = [];
const seenMap: Map<string, boolean> = new Map<string, boolean>();
const addCommand = (id: string, includeCommandWithArgs: boolean) => {
if (seenMap.has(id)) {
return;
}
seenMap.set(id, true);
if (id[0] === '_' || id.indexOf('vscode.') === 0) { // private command
return;
}
if (boundCommands.get(id) === true) {
return;
}
if (!includeCommandWithArgs) {
const command = CommandsRegistry.getCommand(id);
if (command && typeof command.description === 'object'
&& isNonEmptyArray((<ICommandHandlerDescription>command.description).args)) { // command with args
return;
}
}
unboundCommands.push(id);
};
for (const id of MenuRegistry.getCommands().keys()) {
addCommand(id, true);
}
for (const id of CommandsRegistry.getCommands().keys()) {
addCommand(id, false);
}
return unboundCommands;
}
}
function printWhenExplanation(when: ContextKeyExpression | undefined): string {

View File

@@ -23,6 +23,10 @@ export class ResolvedKeybindingItem {
constructor(resolvedKeybinding: ResolvedKeybinding | undefined, command: string | null, commandArgs: any, when: ContextKeyExpression | undefined, isDefault: boolean, extensionId: string | null, isBuiltinExtension: boolean) {
this.resolvedKeybinding = resolvedKeybinding;
this.keypressParts = resolvedKeybinding ? removeElementsAfterNulls(resolvedKeybinding.getDispatchParts()) : [];
if (resolvedKeybinding && this.keypressParts.length === 0) {
// handle possible single modifier chord keybindings
this.keypressParts = removeElementsAfterNulls(resolvedKeybinding.getSingleModifierDispatchParts());
}
this.bubble = (command ? command.charCodeAt(0) === CharCode.Caret : false);
this.command = this.bubble ? command!.substr(1) : command;
this.commandArgs = commandArgs;

View File

@@ -111,4 +111,20 @@ export class USLayoutResolvedKeybinding extends BaseResolvedKeybinding<SimpleKey
return result;
}
protected _getSingleModifierDispatchPart(keybinding: SimpleKeybinding): string | null {
if (keybinding.keyCode === KeyCode.Ctrl && !keybinding.shiftKey && !keybinding.altKey && !keybinding.metaKey) {
return 'ctrl';
}
if (keybinding.keyCode === KeyCode.Shift && !keybinding.ctrlKey && !keybinding.altKey && !keybinding.metaKey) {
return 'shift';
}
if (keybinding.keyCode === KeyCode.Alt && !keybinding.ctrlKey && !keybinding.shiftKey && !keybinding.metaKey) {
return 'alt';
}
if (keybinding.keyCode === KeyCode.Meta && !keybinding.ctrlKey && !keybinding.shiftKey && !keybinding.altKey) {
return 'meta';
}
return null;
}
}

View File

@@ -211,13 +211,13 @@ suite('AbstractKeybindingService', () => {
// send Ctrl/Cmd + K
let shouldPreventDefault = kbService.testDispatch(KeyMod.CtrlCmd | KeyCode.KEY_K);
assert.equal(shouldPreventDefault, true);
assert.deepEqual(executeCommandCalls, []);
assert.deepEqual(showMessageCalls, []);
assert.deepEqual(statusMessageCalls, [
assert.strictEqual(shouldPreventDefault, true);
assert.deepStrictEqual(executeCommandCalls, []);
assert.deepStrictEqual(showMessageCalls, []);
assert.deepStrictEqual(statusMessageCalls, [
`(${toUsLabel(KeyMod.CtrlCmd | KeyCode.KEY_K)}) was pressed. Waiting for second key of chord...`
]);
assert.deepEqual(statusMessageCallsDisposed, []);
assert.deepStrictEqual(statusMessageCallsDisposed, []);
executeCommandCalls = [];
showMessageCalls = [];
statusMessageCalls = [];
@@ -225,13 +225,13 @@ suite('AbstractKeybindingService', () => {
// send backspace
shouldPreventDefault = kbService.testDispatch(KeyCode.Backspace);
assert.equal(shouldPreventDefault, true);
assert.deepEqual(executeCommandCalls, []);
assert.deepEqual(showMessageCalls, []);
assert.deepEqual(statusMessageCalls, [
assert.strictEqual(shouldPreventDefault, true);
assert.deepStrictEqual(executeCommandCalls, []);
assert.deepStrictEqual(showMessageCalls, []);
assert.deepStrictEqual(statusMessageCalls, [
`The key combination (${toUsLabel(KeyMod.CtrlCmd | KeyCode.KEY_K)}, ${toUsLabel(KeyCode.Backspace)}) is not a command.`
]);
assert.deepEqual(statusMessageCallsDisposed, [
assert.deepStrictEqual(statusMessageCallsDisposed, [
`(${toUsLabel(KeyMod.CtrlCmd | KeyCode.KEY_K)}) was pressed. Waiting for second key of chord...`
]);
executeCommandCalls = [];
@@ -241,14 +241,14 @@ suite('AbstractKeybindingService', () => {
// send backspace
shouldPreventDefault = kbService.testDispatch(KeyCode.Backspace);
assert.equal(shouldPreventDefault, true);
assert.deepEqual(executeCommandCalls, [{
assert.strictEqual(shouldPreventDefault, true);
assert.deepStrictEqual(executeCommandCalls, [{
commandId: 'simpleCommand',
args: [null]
}]);
assert.deepEqual(showMessageCalls, []);
assert.deepEqual(statusMessageCalls, []);
assert.deepEqual(statusMessageCallsDisposed, []);
assert.deepStrictEqual(showMessageCalls, []);
assert.deepStrictEqual(statusMessageCalls, []);
assert.deepStrictEqual(statusMessageCallsDisposed, []);
executeCommandCalls = [];
showMessageCalls = [];
statusMessageCalls = [];
@@ -273,11 +273,11 @@ suite('AbstractKeybindingService', () => {
function assertIsIgnored(keybinding: number): void {
let shouldPreventDefault = kbService.testDispatch(keybinding);
assert.equal(shouldPreventDefault, false);
assert.deepEqual(executeCommandCalls, []);
assert.deepEqual(showMessageCalls, []);
assert.deepEqual(statusMessageCalls, []);
assert.deepEqual(statusMessageCallsDisposed, []);
assert.strictEqual(shouldPreventDefault, false);
assert.deepStrictEqual(executeCommandCalls, []);
assert.deepStrictEqual(showMessageCalls, []);
assert.deepStrictEqual(statusMessageCalls, []);
assert.deepStrictEqual(statusMessageCallsDisposed, []);
executeCommandCalls = [];
showMessageCalls = [];
statusMessageCalls = [];
@@ -310,14 +310,14 @@ suite('AbstractKeybindingService', () => {
key1: true
});
let shouldPreventDefault = kbService.testDispatch(KeyMod.CtrlCmd | KeyCode.KEY_K);
assert.equal(shouldPreventDefault, true);
assert.deepEqual(executeCommandCalls, [{
assert.strictEqual(shouldPreventDefault, true);
assert.deepStrictEqual(executeCommandCalls, [{
commandId: 'simpleCommand',
args: [null]
}]);
assert.deepEqual(showMessageCalls, []);
assert.deepEqual(statusMessageCalls, []);
assert.deepEqual(statusMessageCallsDisposed, []);
assert.deepStrictEqual(showMessageCalls, []);
assert.deepStrictEqual(statusMessageCalls, []);
assert.deepStrictEqual(statusMessageCallsDisposed, []);
executeCommandCalls = [];
showMessageCalls = [];
statusMessageCalls = [];
@@ -326,13 +326,13 @@ suite('AbstractKeybindingService', () => {
// send Ctrl/Cmd + K
currentContextValue = createContext({});
shouldPreventDefault = kbService.testDispatch(KeyMod.CtrlCmd | KeyCode.KEY_K);
assert.equal(shouldPreventDefault, true);
assert.deepEqual(executeCommandCalls, []);
assert.deepEqual(showMessageCalls, []);
assert.deepEqual(statusMessageCalls, [
assert.strictEqual(shouldPreventDefault, true);
assert.deepStrictEqual(executeCommandCalls, []);
assert.deepStrictEqual(showMessageCalls, []);
assert.deepStrictEqual(statusMessageCalls, [
`(${toUsLabel(KeyMod.CtrlCmd | KeyCode.KEY_K)}) was pressed. Waiting for second key of chord...`
]);
assert.deepEqual(statusMessageCallsDisposed, []);
assert.deepStrictEqual(statusMessageCallsDisposed, []);
executeCommandCalls = [];
showMessageCalls = [];
statusMessageCalls = [];
@@ -341,14 +341,14 @@ suite('AbstractKeybindingService', () => {
// send Ctrl/Cmd + X
currentContextValue = createContext({});
shouldPreventDefault = kbService.testDispatch(KeyMod.CtrlCmd | KeyCode.KEY_X);
assert.equal(shouldPreventDefault, true);
assert.deepEqual(executeCommandCalls, [{
assert.strictEqual(shouldPreventDefault, true);
assert.deepStrictEqual(executeCommandCalls, [{
commandId: 'chordCommand',
args: [null]
}]);
assert.deepEqual(showMessageCalls, []);
assert.deepEqual(statusMessageCalls, []);
assert.deepEqual(statusMessageCallsDisposed, [
assert.deepStrictEqual(showMessageCalls, []);
assert.deepStrictEqual(statusMessageCalls, []);
assert.deepStrictEqual(statusMessageCallsDisposed, [
`(${toUsLabel(KeyMod.CtrlCmd | KeyCode.KEY_K)}) was pressed. Waiting for second key of chord...`
]);
executeCommandCalls = [];
@@ -370,14 +370,14 @@ suite('AbstractKeybindingService', () => {
// send Ctrl/Cmd + K
currentContextValue = createContext({});
let shouldPreventDefault = kbService.testDispatch(KeyMod.CtrlCmd | KeyCode.KEY_K);
assert.equal(shouldPreventDefault, true);
assert.deepEqual(executeCommandCalls, [{
assert.strictEqual(shouldPreventDefault, true);
assert.deepStrictEqual(executeCommandCalls, [{
commandId: 'simpleCommand',
args: [null]
}]);
assert.deepEqual(showMessageCalls, []);
assert.deepEqual(statusMessageCalls, []);
assert.deepEqual(statusMessageCallsDisposed, []);
assert.deepStrictEqual(showMessageCalls, []);
assert.deepStrictEqual(statusMessageCalls, []);
assert.deepStrictEqual(statusMessageCallsDisposed, []);
executeCommandCalls = [];
showMessageCalls = [];
statusMessageCalls = [];
@@ -388,14 +388,14 @@ suite('AbstractKeybindingService', () => {
key1: true
});
shouldPreventDefault = kbService.testDispatch(KeyMod.CtrlCmd | KeyCode.KEY_K);
assert.equal(shouldPreventDefault, true);
assert.deepEqual(executeCommandCalls, [{
assert.strictEqual(shouldPreventDefault, true);
assert.deepStrictEqual(executeCommandCalls, [{
commandId: 'simpleCommand',
args: [null]
}]);
assert.deepEqual(showMessageCalls, []);
assert.deepEqual(statusMessageCalls, []);
assert.deepEqual(statusMessageCallsDisposed, []);
assert.deepStrictEqual(showMessageCalls, []);
assert.deepStrictEqual(statusMessageCalls, []);
assert.deepStrictEqual(statusMessageCallsDisposed, []);
executeCommandCalls = [];
showMessageCalls = [];
statusMessageCalls = [];
@@ -406,11 +406,11 @@ suite('AbstractKeybindingService', () => {
key1: true
});
shouldPreventDefault = kbService.testDispatch(KeyMod.CtrlCmd | KeyCode.KEY_X);
assert.equal(shouldPreventDefault, false);
assert.deepEqual(executeCommandCalls, []);
assert.deepEqual(showMessageCalls, []);
assert.deepEqual(statusMessageCalls, []);
assert.deepEqual(statusMessageCallsDisposed, []);
assert.strictEqual(shouldPreventDefault, false);
assert.deepStrictEqual(executeCommandCalls, []);
assert.deepStrictEqual(showMessageCalls, []);
assert.deepStrictEqual(statusMessageCalls, []);
assert.deepStrictEqual(statusMessageCallsDisposed, []);
executeCommandCalls = [];
showMessageCalls = [];
statusMessageCalls = [];
@@ -428,14 +428,14 @@ suite('AbstractKeybindingService', () => {
// send Ctrl/Cmd + K
currentContextValue = createContext({});
let shouldPreventDefault = kbService.testDispatch(KeyMod.CtrlCmd | KeyCode.KEY_K);
assert.equal(shouldPreventDefault, false);
assert.deepEqual(executeCommandCalls, [{
assert.strictEqual(shouldPreventDefault, false);
assert.deepStrictEqual(executeCommandCalls, [{
commandId: 'simpleCommand',
args: [null]
}]);
assert.deepEqual(showMessageCalls, []);
assert.deepEqual(statusMessageCalls, []);
assert.deepEqual(statusMessageCallsDisposed, []);
assert.deepStrictEqual(showMessageCalls, []);
assert.deepStrictEqual(statusMessageCalls, []);
assert.deepStrictEqual(statusMessageCallsDisposed, []);
executeCommandCalls = [];
showMessageCalls = [];
statusMessageCalls = [];

View File

@@ -11,7 +11,7 @@ suite('KeybindingLabels', () => {
function assertUSLabel(OS: OperatingSystem, keybinding: number, expected: string): void {
const usResolvedKeybinding = new USLayoutResolvedKeybinding(createKeybinding(keybinding, OS)!, OS);
assert.equal(usResolvedKeybinding.getLabel(), expected);
assert.strictEqual(usResolvedKeybinding.getLabel(), expected);
}
test('Windows US label', () => {
@@ -116,7 +116,7 @@ suite('KeybindingLabels', () => {
test('Aria label', () => {
function assertAriaLabel(OS: OperatingSystem, keybinding: number, expected: string): void {
const usResolvedKeybinding = new USLayoutResolvedKeybinding(createKeybinding(keybinding, OS)!, OS);
assert.equal(usResolvedKeybinding.getAriaLabel(), expected);
assert.strictEqual(usResolvedKeybinding.getAriaLabel(), expected);
}
assertAriaLabel(OperatingSystem.Windows, KeyMod.CtrlCmd | KeyMod.Shift | KeyMod.Alt | KeyMod.WinCtrl | KeyCode.KEY_A, 'Control+Shift+Alt+Windows+A');
@@ -127,7 +127,7 @@ suite('KeybindingLabels', () => {
test('Electron Accelerator label', () => {
function assertElectronAcceleratorLabel(OS: OperatingSystem, keybinding: number, expected: string | null): void {
const usResolvedKeybinding = new USLayoutResolvedKeybinding(createKeybinding(keybinding, OS)!, OS);
assert.equal(usResolvedKeybinding.getElectronAccelerator(), expected);
assert.strictEqual(usResolvedKeybinding.getElectronAccelerator(), expected);
}
assertElectronAcceleratorLabel(OperatingSystem.Windows, KeyMod.CtrlCmd | KeyMod.Shift | KeyMod.Alt | KeyMod.WinCtrl | KeyCode.KEY_A, 'Ctrl+Shift+Alt+Super+A');
@@ -154,7 +154,7 @@ suite('KeybindingLabels', () => {
test('User Settings label', () => {
function assertElectronAcceleratorLabel(OS: OperatingSystem, keybinding: number, expected: string): void {
const usResolvedKeybinding = new USLayoutResolvedKeybinding(createKeybinding(keybinding, OS)!, OS);
assert.equal(usResolvedKeybinding.getUserSettingsLabel(), expected);
assert.strictEqual(usResolvedKeybinding.getUserSettingsLabel(), expected);
}
assertElectronAcceleratorLabel(OperatingSystem.Windows, KeyMod.CtrlCmd | KeyMod.Shift | KeyMod.Alt | KeyMod.WinCtrl | KeyCode.KEY_A, 'ctrl+shift+alt+win+a');

View File

@@ -43,12 +43,12 @@ suite('KeybindingResolver', () => {
let contextRules = ContextKeyExpr.equals('bar', 'baz');
let keybindingItem = kbItem(keybinding, 'yes', null, contextRules, true);
assert.equal(KeybindingResolver.contextMatchesRules(createContext({ bar: 'baz' }), contextRules), true);
assert.equal(KeybindingResolver.contextMatchesRules(createContext({ bar: 'bz' }), contextRules), false);
assert.strictEqual(KeybindingResolver.contextMatchesRules(createContext({ bar: 'baz' }), contextRules), true);
assert.strictEqual(KeybindingResolver.contextMatchesRules(createContext({ bar: 'bz' }), contextRules), false);
let resolver = new KeybindingResolver([keybindingItem], [], () => { });
assert.equal(resolver.resolve(createContext({ bar: 'baz' }), null, getDispatchStr(runtimeKeybinding))!.commandId, 'yes');
assert.equal(resolver.resolve(createContext({ bar: 'bz' }), null, getDispatchStr(runtimeKeybinding)), null);
assert.strictEqual(resolver.resolve(createContext({ bar: 'baz' }), null, getDispatchStr(runtimeKeybinding))!.commandId, 'yes');
assert.strictEqual(resolver.resolve(createContext({ bar: 'bz' }), null, getDispatchStr(runtimeKeybinding)), null);
});
test('resolve key with arguments', function () {
@@ -59,7 +59,7 @@ suite('KeybindingResolver', () => {
let keybindingItem = kbItem(keybinding, 'yes', commandArgs, contextRules, true);
let resolver = new KeybindingResolver([keybindingItem], [], () => { });
assert.equal(resolver.resolve(createContext({ bar: 'baz' }), null, getDispatchStr(runtimeKeybinding))!.commandArgs, commandArgs);
assert.strictEqual(resolver.resolve(createContext({ bar: 'baz' }), null, getDispatchStr(runtimeKeybinding))!.commandArgs, commandArgs);
});
test('KeybindingResolver.combine simple 1', function () {
@@ -70,7 +70,7 @@ suite('KeybindingResolver', () => {
kbItem(KeyCode.KEY_B, 'yes2', null, ContextKeyExpr.equals('2', 'b'), false)
];
let actual = KeybindingResolver.combine(defaults, overrides);
assert.deepEqual(actual, [
assert.deepStrictEqual(actual, [
kbItem(KeyCode.KEY_A, 'yes1', null, ContextKeyExpr.equals('1', 'a'), true),
kbItem(KeyCode.KEY_B, 'yes2', null, ContextKeyExpr.equals('2', 'b'), false),
]);
@@ -85,7 +85,7 @@ suite('KeybindingResolver', () => {
kbItem(KeyCode.KEY_C, 'yes3', null, ContextKeyExpr.equals('3', 'c'), false)
];
let actual = KeybindingResolver.combine(defaults, overrides);
assert.deepEqual(actual, [
assert.deepStrictEqual(actual, [
kbItem(KeyCode.KEY_A, 'yes1', null, ContextKeyExpr.equals('1', 'a'), true),
kbItem(KeyCode.KEY_B, 'yes2', null, ContextKeyExpr.equals('2', 'b'), true),
kbItem(KeyCode.KEY_C, 'yes3', null, ContextKeyExpr.equals('3', 'c'), false),
@@ -101,7 +101,7 @@ suite('KeybindingResolver', () => {
kbItem(KeyCode.KEY_A, '-yes1', null, ContextKeyExpr.equals('1', 'b'), false)
];
let actual = KeybindingResolver.combine(defaults, overrides);
assert.deepEqual(actual, [
assert.deepStrictEqual(actual, [
kbItem(KeyCode.KEY_A, 'yes1', null, ContextKeyExpr.equals('1', 'a'), true),
kbItem(KeyCode.KEY_B, 'yes2', null, ContextKeyExpr.equals('2', 'b'), true)
]);
@@ -116,7 +116,7 @@ suite('KeybindingResolver', () => {
kbItem(KeyCode.KEY_B, '-yes1', null, ContextKeyExpr.equals('1', 'a'), false)
];
let actual = KeybindingResolver.combine(defaults, overrides);
assert.deepEqual(actual, [
assert.deepStrictEqual(actual, [
kbItem(KeyCode.KEY_A, 'yes1', null, ContextKeyExpr.equals('1', 'a'), true),
kbItem(KeyCode.KEY_B, 'yes2', null, ContextKeyExpr.equals('2', 'b'), true)
]);
@@ -131,7 +131,7 @@ suite('KeybindingResolver', () => {
kbItem(KeyCode.KEY_A, '-yes1', null, ContextKeyExpr.equals('1', 'a'), false)
];
let actual = KeybindingResolver.combine(defaults, overrides);
assert.deepEqual(actual, [
assert.deepStrictEqual(actual, [
kbItem(KeyCode.KEY_B, 'yes2', null, ContextKeyExpr.equals('2', 'b'), true)
]);
});
@@ -145,7 +145,7 @@ suite('KeybindingResolver', () => {
kbItem(0, '-yes1', null, ContextKeyExpr.equals('1', 'a'), false)
];
let actual = KeybindingResolver.combine(defaults, overrides);
assert.deepEqual(actual, [
assert.deepStrictEqual(actual, [
kbItem(KeyCode.KEY_B, 'yes2', null, ContextKeyExpr.equals('2', 'b'), true)
]);
});
@@ -159,7 +159,7 @@ suite('KeybindingResolver', () => {
kbItem(KeyCode.KEY_A, '-yes1', null, null!, false)
];
let actual = KeybindingResolver.combine(defaults, overrides);
assert.deepEqual(actual, [
assert.deepStrictEqual(actual, [
kbItem(KeyCode.KEY_B, 'yes2', null, ContextKeyExpr.equals('2', 'b'), true)
]);
});
@@ -173,7 +173,7 @@ suite('KeybindingResolver', () => {
kbItem(0, '-yes1', null, null!, false)
];
let actual = KeybindingResolver.combine(defaults, overrides);
assert.deepEqual(actual, [
assert.deepStrictEqual(actual, [
kbItem(KeyCode.KEY_B, 'yes2', null, ContextKeyExpr.equals('2', 'b'), true)
]);
});
@@ -187,17 +187,17 @@ suite('KeybindingResolver', () => {
kbItem(KeyCode.KEY_A, '-yes1', null, null!, false)
];
let actual = KeybindingResolver.combine(defaults, overrides);
assert.deepEqual(actual, [
assert.deepStrictEqual(actual, [
kbItem(KeyCode.KEY_B, 'yes2', null, ContextKeyExpr.equals('2', 'b'), true)
]);
});
test('contextIsEntirelyIncluded', () => {
const assertIsIncluded = (a: string | null, b: string | null) => {
assert.equal(KeybindingResolver.whenIsEntirelyIncluded(ContextKeyExpr.deserialize(a), ContextKeyExpr.deserialize(b)), true);
assert.strictEqual(KeybindingResolver.whenIsEntirelyIncluded(ContextKeyExpr.deserialize(a), ContextKeyExpr.deserialize(b)), true);
};
const assertIsNotIncluded = (a: string | null, b: string | null) => {
assert.equal(KeybindingResolver.whenIsEntirelyIncluded(ContextKeyExpr.deserialize(a), ContextKeyExpr.deserialize(b)), false);
assert.strictEqual(KeybindingResolver.whenIsEntirelyIncluded(ContextKeyExpr.deserialize(a), ContextKeyExpr.deserialize(b)), false);
};
assertIsIncluded('key1', null);
@@ -314,11 +314,11 @@ suite('KeybindingResolver', () => {
let testKey = (commandId: string, expectedKeys: number[]) => {
// Test lookup
let lookupResult = resolver.lookupKeybindings(commandId);
assert.equal(lookupResult.length, expectedKeys.length, 'Length mismatch @ commandId ' + commandId + '; GOT: ' + JSON.stringify(lookupResult, null, '\t'));
assert.strictEqual(lookupResult.length, expectedKeys.length, 'Length mismatch @ commandId ' + commandId + '; GOT: ' + JSON.stringify(lookupResult, null, '\t'));
for (let i = 0, len = lookupResult.length; i < len; i++) {
const expected = new USLayoutResolvedKeybinding(createKeybinding(expectedKeys[i], OS)!, OS);
assert.equal(lookupResult[i].resolvedKeybinding!.getUserSettingsLabel(), expected.getUserSettingsLabel(), 'value mismatch @ commandId ' + commandId);
assert.strictEqual(lookupResult[i].resolvedKeybinding!.getUserSettingsLabel(), expected.getUserSettingsLabel(), 'value mismatch @ commandId ' + commandId);
}
};
@@ -333,14 +333,14 @@ suite('KeybindingResolver', () => {
// if it's the final part, then we should find a valid command,
// and there should not be a chord.
assert.ok(result !== null, `Enters chord for ${commandId} at part ${i}`);
assert.equal(result!.commandId, commandId, `Enters chord for ${commandId} at part ${i}`);
assert.equal(result!.enterChord, false, `Enters chord for ${commandId} at part ${i}`);
assert.strictEqual(result!.commandId, commandId, `Enters chord for ${commandId} at part ${i}`);
assert.strictEqual(result!.enterChord, false, `Enters chord for ${commandId} at part ${i}`);
} else {
// if it's not the final part, then we should not find a valid command,
// and there should be a chord.
assert.ok(result !== null, `Enters chord for ${commandId} at part ${i}`);
assert.equal(result!.commandId, null, `Enters chord for ${commandId} at part ${i}`);
assert.equal(result!.enterChord, true, `Enters chord for ${commandId} at part ${i}`);
assert.strictEqual(result!.commandId, null, `Enters chord for ${commandId} at part ${i}`);
assert.strictEqual(result!.enterChord, true, `Enters chord for ${commandId} at part ${i}`);
}
previousPart = part;
}