Merge vscode 1.67 (#20883)

* Fix initial build breaks from 1.67 merge (#2514)

* Update yarn lock files

* Update build scripts

* Fix tsconfig

* Build breaks

* WIP

* Update yarn lock files

* Misc breaks

* Updates to package.json

* Breaks

* Update yarn

* Fix breaks

* Breaks

* Build breaks

* Breaks

* Breaks

* Breaks

* Breaks

* Breaks

* Missing file

* Breaks

* Breaks

* Breaks

* Breaks

* Breaks

* Fix several runtime breaks (#2515)

* Missing files

* Runtime breaks

* Fix proxy ordering issue

* Remove commented code

* Fix breaks with opening query editor

* Fix post merge break

* Updates related to setup build and other breaks (#2516)

* Fix bundle build issues

* Update distro

* Fix distro merge and update build JS files

* Disable pipeline steps

* Remove stats call

* Update license name

* Make new RPM dependencies a warning

* Fix extension manager version checks

* Update JS file

* Fix a few runtime breaks

* Fixes

* Fix runtime issues

* Fix build breaks

* Update notebook tests (part 1)

* Fix broken tests

* Linting errors

* Fix hygiene

* Disable lint rules

* Bump distro

* Turn off smoke tests

* Disable integration tests

* Remove failing "activate" test

* Remove failed test assertion

* Disable other broken test

* Disable query history tests

* Disable extension unit tests

* Disable failing tasks
This commit is contained in:
Karl Burtram
2022-10-19 19:13:18 -07:00
committed by GitHub
parent 33c6daaea1
commit 8a3d08f0de
3738 changed files with 192313 additions and 107208 deletions

View File

@@ -33,9 +33,9 @@ export class KeybindingResolver {
this._defaultKeybindings = defaultKeybindings;
this._defaultBoundCommands = new Map<string, boolean>();
for (let i = 0, len = defaultKeybindings.length; i < len; i++) {
const command = defaultKeybindings[i].command;
if (command) {
for (const defaultKeybinding of defaultKeybindings) {
const command = defaultKeybinding.command;
if (command && command.charAt(0) !== '-') {
this._defaultBoundCommands.set(command, true);
}
}
@@ -43,7 +43,7 @@ export class KeybindingResolver {
this._map = new Map<string, ResolvedKeybindingItem[]>();
this._lookupMap = new Map<string, ResolvedKeybindingItem[]>();
this._keybindings = KeybindingResolver.combine(defaultKeybindings, overrides);
this._keybindings = KeybindingResolver.handleRemovals(([] as ResolvedKeybindingItem[]).concat(defaultKeybindings).concat(overrides));
for (let i = 0, len = this._keybindings.length; i < len; i++) {
let k = this._keybindings[i];
if (k.keypressParts.length === 0) {
@@ -61,10 +61,7 @@ export class KeybindingResolver {
}
}
private static _isTargetedForRemoval(defaultKb: ResolvedKeybindingItem, keypressFirstPart: string | null, keypressChordPart: string | null, command: string, when: ContextKeyExpression | undefined): boolean {
if (defaultKb.command !== command) {
return false;
}
private static _isTargetedForRemoval(defaultKb: ResolvedKeybindingItem, keypressFirstPart: string | null, keypressChordPart: string | null, when: ContextKeyExpression | undefined): boolean {
// TODO@chords
if (keypressFirstPart && defaultKb.keypressParts[0] !== keypressFirstPart) {
return false;
@@ -86,29 +83,62 @@ export class KeybindingResolver {
}
/**
* Looks for rules containing -command in `overrides` and removes them directly from `defaults`.
* Looks for rules containing "-commandId" and removes them.
*/
public static combine(defaults: ResolvedKeybindingItem[], rawOverrides: ResolvedKeybindingItem[]): ResolvedKeybindingItem[] {
defaults = defaults.slice(0);
let overrides: ResolvedKeybindingItem[] = [];
for (const override of rawOverrides) {
if (!override.command || override.command.length === 0 || override.command.charAt(0) !== '-') {
overrides.push(override);
continue;
}
const command = override.command.substr(1);
// TODO@chords
const keypressFirstPart = override.keypressParts[0];
const keypressChordPart = override.keypressParts[1];
const when = override.when;
for (let j = defaults.length - 1; j >= 0; j--) {
if (this._isTargetedForRemoval(defaults[j], keypressFirstPart, keypressChordPart, command, when)) {
defaults.splice(j, 1);
public static handleRemovals(rules: ResolvedKeybindingItem[]): ResolvedKeybindingItem[] {
// Do a first pass and construct a hash-map for removals
const removals = new Map<string, ResolvedKeybindingItem[]>();
for (let i = 0, len = rules.length; i < len; i++) {
const rule = rules[i];
if (rule.command && rule.command.charAt(0) === '-') {
const command = rule.command.substring(1);
if (!removals.has(command)) {
removals.set(command, [rule]);
} else {
removals.get(command)!.push(rule);
}
}
}
return defaults.concat(overrides);
if (removals.size === 0) {
// There are no removals
return rules;
}
// Do a second pass and keep only non-removed keybindings
const result: ResolvedKeybindingItem[] = [];
for (let i = 0, len = rules.length; i < len; i++) {
const rule = rules[i];
if (!rule.command || rule.command.length === 0) {
result.push(rule);
continue;
}
if (rule.command.charAt(0) === '-') {
continue;
}
const commandRemovals = removals.get(rule.command);
if (!commandRemovals || !rule.isDefault) {
result.push(rule);
continue;
}
let isRemoved = false;
for (const commandRemoval of commandRemovals) {
// TODO@chords
const keypressFirstPart = commandRemoval.keypressParts[0];
const keypressChordPart = commandRemoval.keypressParts[1];
const when = commandRemoval.when;
if (this._isTargetedForRemoval(rule, keypressFirstPart, keypressChordPart, when)) {
isRemoved = true;
break;
}
}
if (!isRemoved) {
result.push(rule);
continue;
}
}
return result;
}
private _addKeyPress(keypress: string, item: ResolvedKeybindingItem): void {
@@ -303,7 +333,7 @@ export class KeybindingResolver {
for (let i = matches.length - 1; i >= 0; i--) {
let k = matches[i];
if (!KeybindingResolver.contextMatchesRules(context, k.when)) {
if (!KeybindingResolver._contextMatchesRules(context, k.when)) {
continue;
}
@@ -313,7 +343,7 @@ export class KeybindingResolver {
return null;
}
public static contextMatchesRules(context: IContext, rules: ContextKeyExpression | null | undefined): boolean {
private static _contextMatchesRules(context: IContext, rules: ContextKeyExpression | null | undefined): boolean {
if (!rules) {
return true;
}

View File

@@ -90,7 +90,7 @@ class KeybindingsRegistryImpl implements IKeybindingsRegistry {
/**
* Take current platform into account and reduce to primary & secondary.
*/
private static bindToCurrentPlatform(kb: IKeybindings): { primary?: number; secondary?: number[]; } {
private static bindToCurrentPlatform(kb: IKeybindings): { primary?: number; secondary?: number[] } {
if (OS === OperatingSystem.Windows) {
if (kb && kb.win) {
return kb.win;

View File

@@ -97,8 +97,8 @@ suite('AbstractKeybindingService', () => {
let createTestKeybindingService: (items: ResolvedKeybindingItem[], contextValue?: any) => TestKeybindingService = null!;
let currentContextValue: IContext | null = null;
let executeCommandCalls: { commandId: string; args: any[]; }[] = null!;
let showMessageCalls: { sev: Severity, message: any; }[] = null!;
let executeCommandCalls: { commandId: string; args: any[] }[] = null!;
let showMessageCalls: { sev: Severity; message: any }[] = null!;
let statusMessageCalls: string[] | null = null;
let statusMessageCallsDisposed: string[] | null = null;

View File

@@ -122,7 +122,7 @@ suite('KeybindingLabels', () => {
assertAriaLabel(OperatingSystem.Windows, KeyMod.CtrlCmd | KeyMod.Shift | KeyMod.Alt | KeyMod.WinCtrl | KeyCode.KeyA, 'Control+Shift+Alt+Windows+A');
assertAriaLabel(OperatingSystem.Linux, KeyMod.CtrlCmd | KeyMod.Shift | KeyMod.Alt | KeyMod.WinCtrl | KeyCode.KeyA, 'Control+Shift+Alt+Super+A');
assertAriaLabel(OperatingSystem.Macintosh, KeyMod.CtrlCmd | KeyMod.Shift | KeyMod.Alt | KeyMod.WinCtrl | KeyCode.KeyA, 'Control+Shift+Alt+Command+A');
assertAriaLabel(OperatingSystem.Macintosh, KeyMod.CtrlCmd | KeyMod.Shift | KeyMod.Alt | KeyMod.WinCtrl | KeyCode.KeyA, 'Control+Shift+Option+Command+A');
});
test('Electron Accelerator label', () => {

View File

@@ -2,9 +2,10 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import { KeyChord, KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import { createKeybinding, createSimpleKeybinding, SimpleKeybinding } from 'vs/base/common/keybindings';
import { KeyChord, KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import { OS } from 'vs/base/common/platform';
import { ContextKeyExpr, ContextKeyExpression, IContext } from 'vs/platform/contextkey/common/contextkey';
import { KeybindingResolver } from 'vs/platform/keybinding/common/keybindingResolver';
@@ -38,54 +39,54 @@ suite('KeybindingResolver', () => {
return USLayoutResolvedKeybinding.getDispatchStr(runtimeKb)!;
}
test('resolve key', function () {
let keybinding = KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KeyZ;
let runtimeKeybinding = createSimpleKeybinding(keybinding, OS);
let contextRules = ContextKeyExpr.equals('bar', 'baz');
let keybindingItem = kbItem(keybinding, 'yes', null, contextRules, true);
test('resolve key', () => {
const keybinding = KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KeyZ;
const runtimeKeybinding = createSimpleKeybinding(keybinding, OS);
const contextRules = ContextKeyExpr.equals('bar', 'baz');
const keybindingItem = kbItem(keybinding, 'yes', null, contextRules, true);
assert.strictEqual(KeybindingResolver.contextMatchesRules(createContext({ bar: 'baz' }), contextRules), true);
assert.strictEqual(KeybindingResolver.contextMatchesRules(createContext({ bar: 'bz' }), contextRules), false);
assert.strictEqual(contextRules.evaluate(createContext({ bar: 'baz' })), true);
assert.strictEqual(contextRules.evaluate(createContext({ bar: 'bz' })), false);
let resolver = new KeybindingResolver([keybindingItem], [], () => { });
const resolver = new KeybindingResolver([keybindingItem], [], () => { });
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 () {
let commandArgs = { text: 'no' };
let keybinding = KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KeyZ;
let runtimeKeybinding = createSimpleKeybinding(keybinding, OS);
let contextRules = ContextKeyExpr.equals('bar', 'baz');
let keybindingItem = kbItem(keybinding, 'yes', commandArgs, contextRules, true);
test('resolve key with arguments', () => {
const commandArgs = { text: 'no' };
const keybinding = KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KeyZ;
const runtimeKeybinding = createSimpleKeybinding(keybinding, OS);
const contextRules = ContextKeyExpr.equals('bar', 'baz');
const keybindingItem = kbItem(keybinding, 'yes', commandArgs, contextRules, true);
let resolver = new KeybindingResolver([keybindingItem], [], () => { });
const resolver = new KeybindingResolver([keybindingItem], [], () => { });
assert.strictEqual(resolver.resolve(createContext({ bar: 'baz' }), null, getDispatchStr(runtimeKeybinding))!.commandArgs, commandArgs);
});
test('KeybindingResolver.combine simple 1', function () {
let defaults = [
test('KeybindingResolver.handleRemovals simple 1', () => {
const defaults = [
kbItem(KeyCode.KeyA, 'yes1', null, ContextKeyExpr.equals('1', 'a'), true)
];
let overrides = [
const overrides = [
kbItem(KeyCode.KeyB, 'yes2', null, ContextKeyExpr.equals('2', 'b'), false)
];
let actual = KeybindingResolver.combine(defaults, overrides);
const actual = KeybindingResolver.handleRemovals([...defaults, ...overrides]);
assert.deepStrictEqual(actual, [
kbItem(KeyCode.KeyA, 'yes1', null, ContextKeyExpr.equals('1', 'a'), true),
kbItem(KeyCode.KeyB, 'yes2', null, ContextKeyExpr.equals('2', 'b'), false),
]);
});
test('KeybindingResolver.combine simple 2', function () {
let defaults = [
test('KeybindingResolver.handleRemovals simple 2', () => {
const defaults = [
kbItem(KeyCode.KeyA, 'yes1', null, ContextKeyExpr.equals('1', 'a'), true),
kbItem(KeyCode.KeyB, 'yes2', null, ContextKeyExpr.equals('2', 'b'), true)
];
let overrides = [
const overrides = [
kbItem(KeyCode.KeyC, 'yes3', null, ContextKeyExpr.equals('3', 'c'), false)
];
let actual = KeybindingResolver.combine(defaults, overrides);
const actual = KeybindingResolver.handleRemovals([...defaults, ...overrides]);
assert.deepStrictEqual(actual, [
kbItem(KeyCode.KeyA, 'yes1', null, ContextKeyExpr.equals('1', 'a'), true),
kbItem(KeyCode.KeyB, 'yes2', null, ContextKeyExpr.equals('2', 'b'), true),
@@ -93,106 +94,147 @@ suite('KeybindingResolver', () => {
]);
});
test('KeybindingResolver.combine removal with not matching when', function () {
let defaults = [
test('KeybindingResolver.handleRemovals removal with not matching when', () => {
const defaults = [
kbItem(KeyCode.KeyA, 'yes1', null, ContextKeyExpr.equals('1', 'a'), true),
kbItem(KeyCode.KeyB, 'yes2', null, ContextKeyExpr.equals('2', 'b'), true)
];
let overrides = [
const overrides = [
kbItem(KeyCode.KeyA, '-yes1', null, ContextKeyExpr.equals('1', 'b'), false)
];
let actual = KeybindingResolver.combine(defaults, overrides);
const actual = KeybindingResolver.handleRemovals([...defaults, ...overrides]);
assert.deepStrictEqual(actual, [
kbItem(KeyCode.KeyA, 'yes1', null, ContextKeyExpr.equals('1', 'a'), true),
kbItem(KeyCode.KeyB, 'yes2', null, ContextKeyExpr.equals('2', 'b'), true)
]);
});
test('KeybindingResolver.combine removal with not matching keybinding', function () {
let defaults = [
test('KeybindingResolver.handleRemovals removal with not matching keybinding', () => {
const defaults = [
kbItem(KeyCode.KeyA, 'yes1', null, ContextKeyExpr.equals('1', 'a'), true),
kbItem(KeyCode.KeyB, 'yes2', null, ContextKeyExpr.equals('2', 'b'), true)
];
let overrides = [
const overrides = [
kbItem(KeyCode.KeyB, '-yes1', null, ContextKeyExpr.equals('1', 'a'), false)
];
let actual = KeybindingResolver.combine(defaults, overrides);
const actual = KeybindingResolver.handleRemovals([...defaults, ...overrides]);
assert.deepStrictEqual(actual, [
kbItem(KeyCode.KeyA, 'yes1', null, ContextKeyExpr.equals('1', 'a'), true),
kbItem(KeyCode.KeyB, 'yes2', null, ContextKeyExpr.equals('2', 'b'), true)
]);
});
test('KeybindingResolver.combine removal with matching keybinding and when', function () {
let defaults = [
test('KeybindingResolver.handleRemovals removal with matching keybinding and when', () => {
const defaults = [
kbItem(KeyCode.KeyA, 'yes1', null, ContextKeyExpr.equals('1', 'a'), true),
kbItem(KeyCode.KeyB, 'yes2', null, ContextKeyExpr.equals('2', 'b'), true)
];
let overrides = [
const overrides = [
kbItem(KeyCode.KeyA, '-yes1', null, ContextKeyExpr.equals('1', 'a'), false)
];
let actual = KeybindingResolver.combine(defaults, overrides);
const actual = KeybindingResolver.handleRemovals([...defaults, ...overrides]);
assert.deepStrictEqual(actual, [
kbItem(KeyCode.KeyB, 'yes2', null, ContextKeyExpr.equals('2', 'b'), true)
]);
});
test('KeybindingResolver.combine removal with unspecified keybinding', function () {
let defaults = [
test('KeybindingResolver.handleRemovals removal with unspecified keybinding', () => {
const defaults = [
kbItem(KeyCode.KeyA, 'yes1', null, ContextKeyExpr.equals('1', 'a'), true),
kbItem(KeyCode.KeyB, 'yes2', null, ContextKeyExpr.equals('2', 'b'), true)
];
let overrides = [
const overrides = [
kbItem(0, '-yes1', null, ContextKeyExpr.equals('1', 'a'), false)
];
let actual = KeybindingResolver.combine(defaults, overrides);
const actual = KeybindingResolver.handleRemovals([...defaults, ...overrides]);
assert.deepStrictEqual(actual, [
kbItem(KeyCode.KeyB, 'yes2', null, ContextKeyExpr.equals('2', 'b'), true)
]);
});
test('KeybindingResolver.combine removal with unspecified when', function () {
let defaults = [
test('KeybindingResolver.handleRemovals removal with unspecified when', () => {
const defaults = [
kbItem(KeyCode.KeyA, 'yes1', null, ContextKeyExpr.equals('1', 'a'), true),
kbItem(KeyCode.KeyB, 'yes2', null, ContextKeyExpr.equals('2', 'b'), true)
];
let overrides = [
kbItem(KeyCode.KeyA, '-yes1', null, null!, false)
const overrides = [
kbItem(KeyCode.KeyA, '-yes1', null, undefined, false)
];
let actual = KeybindingResolver.combine(defaults, overrides);
const actual = KeybindingResolver.handleRemovals([...defaults, ...overrides]);
assert.deepStrictEqual(actual, [
kbItem(KeyCode.KeyB, 'yes2', null, ContextKeyExpr.equals('2', 'b'), true)
]);
});
test('KeybindingResolver.combine removal with unspecified when and unspecified keybinding', function () {
let defaults = [
test('KeybindingResolver.handleRemovals removal with unspecified when and unspecified keybinding', () => {
const defaults = [
kbItem(KeyCode.KeyA, 'yes1', null, ContextKeyExpr.equals('1', 'a'), true),
kbItem(KeyCode.KeyB, 'yes2', null, ContextKeyExpr.equals('2', 'b'), true)
];
let overrides = [
kbItem(0, '-yes1', null, null!, false)
const overrides = [
kbItem(0, '-yes1', null, undefined, false)
];
let actual = KeybindingResolver.combine(defaults, overrides);
const actual = KeybindingResolver.handleRemovals([...defaults, ...overrides]);
assert.deepStrictEqual(actual, [
kbItem(KeyCode.KeyB, 'yes2', null, ContextKeyExpr.equals('2', 'b'), true)
]);
});
test('issue #612#issuecomment-222109084 cannot remove keybindings for commands with ^', function () {
let defaults = [
test('issue #138997 KeybindingResolver.handleRemovals removal in default list', () => {
const defaults = [
kbItem(KeyCode.KeyA, 'yes1', null, undefined, true),
kbItem(KeyCode.KeyB, 'yes2', null, undefined, true),
kbItem(0, '-yes1', null, undefined, false)
];
const overrides: ResolvedKeybindingItem[] = [];
const actual = KeybindingResolver.handleRemovals([...defaults, ...overrides]);
assert.deepStrictEqual(actual, [
kbItem(KeyCode.KeyB, 'yes2', null, undefined, true)
]);
});
test('issue #612#issuecomment-222109084 cannot remove keybindings for commands with ^', () => {
const defaults = [
kbItem(KeyCode.KeyA, '^yes1', null, ContextKeyExpr.equals('1', 'a'), true),
kbItem(KeyCode.KeyB, 'yes2', null, ContextKeyExpr.equals('2', 'b'), true)
];
let overrides = [
kbItem(KeyCode.KeyA, '-yes1', null, null!, false)
const overrides = [
kbItem(KeyCode.KeyA, '-yes1', null, undefined, false)
];
let actual = KeybindingResolver.combine(defaults, overrides);
const actual = KeybindingResolver.handleRemovals([...defaults, ...overrides]);
assert.deepStrictEqual(actual, [
kbItem(KeyCode.KeyB, 'yes2', null, ContextKeyExpr.equals('2', 'b'), true)
]);
});
test('issue #140884 Unable to reassign F1 as keybinding for Show All Commands', () => {
const defaults = [
kbItem(KeyCode.KeyA, 'command1', null, undefined, true),
];
const overrides = [
kbItem(KeyCode.KeyA, '-command1', null, undefined, false),
kbItem(KeyCode.KeyA, 'command1', null, undefined, false),
];
const actual = KeybindingResolver.handleRemovals([...defaults, ...overrides]);
assert.deepStrictEqual(actual, [
kbItem(KeyCode.KeyA, 'command1', null, undefined, false)
]);
});
test('issue #141638: Keyboard Shortcuts: Change When Expression might actually remove keybinding in Insiders', () => {
const defaults = [
kbItem(KeyCode.KeyA, 'command1', null, undefined, true),
];
const overrides = [
kbItem(KeyCode.KeyA, 'command1', null, ContextKeyExpr.equals('a', '1'), false),
kbItem(KeyCode.KeyA, '-command1', null, undefined, false),
];
const actual = KeybindingResolver.handleRemovals([...defaults, ...overrides]);
assert.deepStrictEqual(actual, [
kbItem(KeyCode.KeyA, 'command1', null, ContextKeyExpr.equals('a', '1'), false)
]);
});
test('contextIsEntirelyIncluded', () => {
const toContextKeyExpression = (expr: ContextKeyExpression | string | null) => {
if (typeof expr === 'string' || !expr) {
@@ -237,13 +279,13 @@ suite('KeybindingResolver', () => {
assertIsNotIncluded(null, 'key2');
});
test('resolve command', function () {
test('resolve command', () => {
function _kbItem(keybinding: number, command: string, when: ContextKeyExpression | undefined): ResolvedKeybindingItem {
return kbItem(keybinding, command, null, when, true);
}
let items = [
const items = [
// This one will never match because its "when" is always overwritten by another one
_kbItem(
KeyCode.KeyX,
@@ -263,7 +305,7 @@ suite('KeybindingResolver', () => {
_kbItem(
KeyCode.KeyZ,
'second',
null!
undefined
),
// This one sometimes overwrites first
_kbItem(
@@ -281,51 +323,51 @@ suite('KeybindingResolver', () => {
_kbItem(
KeyChord(KeyMod.CtrlCmd | KeyCode.KeyY, KeyCode.KeyZ),
'fifth',
null!
undefined
),
// This one has no keybinding
_kbItem(
0,
'sixth',
null!
undefined
),
_kbItem(
KeyChord(KeyMod.CtrlCmd | KeyCode.KeyK, KeyMod.CtrlCmd | KeyCode.KeyU),
'seventh',
null!
undefined
),
_kbItem(
KeyChord(KeyMod.CtrlCmd | KeyCode.KeyK, KeyMod.CtrlCmd | KeyCode.KeyK),
'seventh',
null!
undefined
),
_kbItem(
KeyChord(KeyMod.CtrlCmd | KeyCode.KeyK, KeyMod.CtrlCmd | KeyCode.KeyU),
'uncomment lines',
null!
undefined
),
_kbItem(
KeyChord(KeyMod.CtrlCmd | KeyCode.KeyK, KeyMod.CtrlCmd | KeyCode.KeyC),
'comment lines',
null!
undefined
),
_kbItem(
KeyChord(KeyMod.CtrlCmd | KeyCode.KeyG, KeyMod.CtrlCmd | KeyCode.KeyC),
'unreachablechord',
null!
undefined
),
_kbItem(
KeyMod.CtrlCmd | KeyCode.KeyG,
'eleven',
null!
undefined
)
];
let resolver = new KeybindingResolver(items, [], () => { });
const resolver = new KeybindingResolver(items, [], () => { });
let testKey = (commandId: string, expectedKeys: number[]) => {
const testKey = (commandId: string, expectedKeys: number[]) => {
// Test lookup
let lookupResult = resolver.lookupKeybindings(commandId);
const lookupResult = resolver.lookupKeybindings(commandId);
assert.strictEqual(lookupResult.length, expectedKeys.length, 'Length mismatch @ commandId ' + commandId);
for (let i = 0, len = lookupResult.length; i < len; i++) {
const expected = new USLayoutResolvedKeybinding(createKeybinding(expectedKeys[i], OS)!, OS);
@@ -334,13 +376,13 @@ suite('KeybindingResolver', () => {
}
};
let testResolve = (ctx: IContext, _expectedKey: number, commandId: string) => {
const testResolve = (ctx: IContext, _expectedKey: number, commandId: string) => {
const expectedKey = createKeybinding(_expectedKey, OS)!;
let previousPart: (string | null) = null;
for (let i = 0, len = expectedKey.parts.length; i < len; i++) {
let part = getDispatchStr(expectedKey.parts[i]);
let result = resolver.resolve(ctx, previousPart, part);
const part = getDispatchStr(expectedKey.parts[i]);
const result = resolver.resolve(ctx, previousPart, part);
if (i === len - 1) {
// if it's the final part, then we should find a valid command,
// and there should not be a chord.