Skip to content

Commit c688f7c

Browse files
committed
Remove unused ResolvedKeybinding methods
1 parent 31d6284 commit c688f7c

12 files changed

Lines changed: 18 additions & 822 deletions

File tree

src/vs/base/common/keyCodes.ts

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -573,18 +573,10 @@ export abstract class ResolvedKeybinding {
573573
* This prints the binding in a format suitable for displaying in the UI.
574574
*/
575575
public abstract getLabel(): string;
576-
/**
577-
* Returns the UI label of the binding without modifiers
578-
*/
579-
public abstract getLabelWithoutModifiers(): string;
580576
/**
581577
* This prints the binding in a format suitable for ARIA.
582578
*/
583579
public abstract getAriaLabel(): string;
584-
/**
585-
* Returns the ARIA label of the bindings without modifiers
586-
*/
587-
public abstract getAriaLabelWithoutModifiers(): string;
588580
/**
589581
* This prints the binding in a format suitable for electron's accelerators.
590582
* See https://github.com/electron/electron/blob/master/docs/api/accelerator.md
@@ -603,33 +595,14 @@ export abstract class ResolvedKeybinding {
603595
* Is the binding a chord?
604596
*/
605597
public abstract isChord(): boolean;
606-
/**
607-
* Does this binding use the ctrl modifier key.
608-
* If it is a chord, it always returns false.
609-
*/
610-
public abstract hasCtrlModifier(): boolean;
611-
/**
612-
* Does this binding use the shift modifier key.
613-
* If it is a chord, it always returns false.
614-
*/
615-
public abstract hasShiftModifier(): boolean;
616-
/**
617-
* Does this binding use the alt modifier key.
618-
* If it is a chord, it always returns false.
619-
*/
620-
public abstract hasAltModifier(): boolean;
621-
/**
622-
* Does this binding use the meta modifier key.
623-
* If it is a chord, it always returns false.
624-
*/
625-
public abstract hasMetaModifier(): boolean;
626598

627599
/**
628600
* Returns the firstPart, chordPart that should be used for dispatching.
629601
*/
630602
public abstract getDispatchParts(): [string, string];
631603
/**
632-
* Returns the firstPart, chordPart of the keybinding
604+
* Returns the firstPart, chordPart of the keybinding.
605+
* For simple keybindings, the second element will be null.
633606
*/
634607
public abstract getParts(): [ResolvedKeybindingPart, ResolvedKeybindingPart];
635608
}

src/vs/base/parts/quickopen/browser/quickOpenWidget.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -279,27 +279,28 @@ export class QuickOpenWidget implements IModelProvider {
279279
// Select element when keys are pressed that signal it
280280
const quickNavKeys = this.quickNavigateConfiguration.keybindings;
281281
const wasTriggerKeyPressed = keyCode === KeyCode.Enter || quickNavKeys.some((k) => {
282-
if (k.isChord()) {
282+
const [firstPart, chordPart] = k.getParts();
283+
if (chordPart) {
283284
return false;
284285
}
285286

286-
if (k.hasShiftModifier() && keyCode === KeyCode.Shift) {
287+
if (firstPart.shiftKey && keyCode === KeyCode.Shift) {
287288
if (keyboardEvent.ctrlKey || keyboardEvent.altKey || keyboardEvent.metaKey) {
288289
return false; // this is an optimistic check for the shift key being used to navigate back in quick open
289290
}
290291

291292
return true;
292293
}
293294

294-
if (k.hasAltModifier() && keyCode === KeyCode.Alt) {
295+
if (firstPart.altKey && keyCode === KeyCode.Alt) {
295296
return true;
296297
}
297298

298-
if (k.hasCtrlModifier() && keyCode === KeyCode.Ctrl) {
299+
if (firstPart.ctrlKey && keyCode === KeyCode.Ctrl) {
299300
return true;
300301
}
301302

302-
if (k.hasMetaModifier() && keyCode === KeyCode.Meta) {
303+
if (firstPart.metaKey && keyCode === KeyCode.Meta) {
303304
return true;
304305
}
305306

src/vs/platform/keybinding/common/keybindingLabels.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,6 @@ export interface Modifiers {
2323
readonly metaKey: boolean;
2424
}
2525

26-
export const NO_MODIFIERS: Modifiers = {
27-
ctrlKey: false,
28-
shiftKey: false,
29-
altKey: false,
30-
metaKey: false
31-
};
32-
3326
export class ModifierLabelProvider {
3427

3528
public readonly modifierLabels: ModifierLabels[];

src/vs/platform/keybinding/common/usLayoutResolvedKeybinding.ts

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
'use strict';
66

77
import { ResolvedKeybinding, ResolvedKeybindingPart, KeyCode, KeyCodeUtils, USER_SETTINGS, Keybinding, KeybindingType, SimpleKeybinding } from 'vs/base/common/keyCodes';
8-
import { UILabelProvider, AriaLabelProvider, ElectronAcceleratorLabelProvider, UserSettingsLabelProvider, NO_MODIFIERS } from 'vs/platform/keybinding/common/keybindingLabels';
8+
import { UILabelProvider, AriaLabelProvider, ElectronAcceleratorLabelProvider, UserSettingsLabelProvider } from 'vs/platform/keybinding/common/keybindingLabels';
99
import { OperatingSystem } from 'vs/base/common/platform';
1010

1111
/**
@@ -64,12 +64,6 @@ export class USLayoutResolvedKeybinding extends ResolvedKeybinding {
6464
return UILabelProvider.toLabel(this._firstPart, firstPart, this._chordPart, chordPart, this._os);
6565
}
6666

67-
public getLabelWithoutModifiers(): string {
68-
let firstPart = this._getUILabelForKeybinding(this._firstPart);
69-
let chordPart = this._getUILabelForKeybinding(this._chordPart);
70-
return UILabelProvider.toLabel(NO_MODIFIERS, firstPart, NO_MODIFIERS, chordPart, this._os);
71-
}
72-
7367
private _getAriaLabelForKeybinding(keybinding: SimpleKeybinding): string {
7468
if (!keybinding) {
7569
return null;
@@ -86,12 +80,6 @@ export class USLayoutResolvedKeybinding extends ResolvedKeybinding {
8680
return AriaLabelProvider.toLabel(this._firstPart, firstPart, this._chordPart, chordPart, this._os);
8781
}
8882

89-
public getAriaLabelWithoutModifiers(): string {
90-
let firstPart = this._getAriaLabelForKeybinding(this._firstPart);
91-
let chordPart = this._getAriaLabelForKeybinding(this._chordPart);
92-
return AriaLabelProvider.toLabel(NO_MODIFIERS, firstPart, NO_MODIFIERS, chordPart, this._os);
93-
}
94-
9583
private _keyCodeToElectronAccelerator(keyCode: KeyCode): string {
9684
if (keyCode >= KeyCode.NUMPAD_0 && keyCode <= KeyCode.NUMPAD_DIVIDE) {
9785
// Electron cannot handle numpad keys
@@ -157,34 +145,6 @@ export class USLayoutResolvedKeybinding extends ResolvedKeybinding {
157145
return (this._chordPart ? true : false);
158146
}
159147

160-
public hasCtrlModifier(): boolean {
161-
if (this._chordPart) {
162-
return false;
163-
}
164-
return this._firstPart.ctrlKey;
165-
}
166-
167-
public hasShiftModifier(): boolean {
168-
if (this._chordPart) {
169-
return false;
170-
}
171-
return this._firstPart.shiftKey;
172-
}
173-
174-
public hasAltModifier(): boolean {
175-
if (this._chordPart) {
176-
return false;
177-
}
178-
return this._firstPart.altKey;
179-
}
180-
181-
public hasMetaModifier(): boolean {
182-
if (this._chordPart) {
183-
return false;
184-
}
185-
return this._firstPart.metaKey;
186-
}
187-
188148
public getParts(): [ResolvedKeybindingPart, ResolvedKeybindingPart] {
189149
return [
190150
this._toResolvedKeybindingPart(this._firstPart),

src/vs/platform/keybinding/test/common/keybindingLabels.test.ts

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,15 @@ suite('KeybindingLabels', () => {
1616
assert.equal(usResolvedKeybinding.getLabel(), expected);
1717
}
1818

19-
function assertUSLabelWithoutModifiers(OS: OperatingSystem, keybinding: number, expected: string): void {
20-
const usResolvedKeybinding = new USLayoutResolvedKeybinding(createKeybinding(keybinding, OS), OS);
21-
assert.equal(usResolvedKeybinding.getLabelWithoutModifiers(), expected);
22-
}
23-
2419
test('Windows US label', () => {
2520
// no modifier
2621
assertUSLabel(OperatingSystem.Windows, KeyCode.KEY_A, 'A');
27-
assertUSLabelWithoutModifiers(OperatingSystem.Windows, KeyCode.KEY_A, 'A');
2822

2923
// one modifier
3024
assertUSLabel(OperatingSystem.Windows, KeyMod.CtrlCmd | KeyCode.KEY_A, 'Ctrl+A');
3125
assertUSLabel(OperatingSystem.Windows, KeyMod.Shift | KeyCode.KEY_A, 'Shift+A');
3226
assertUSLabel(OperatingSystem.Windows, KeyMod.Alt | KeyCode.KEY_A, 'Alt+A');
3327
assertUSLabel(OperatingSystem.Windows, KeyMod.WinCtrl | KeyCode.KEY_A, 'Windows+A');
34-
assertUSLabelWithoutModifiers(OperatingSystem.Windows, KeyMod.CtrlCmd | KeyCode.KEY_A, 'A');
35-
assertUSLabelWithoutModifiers(OperatingSystem.Windows, KeyMod.Shift | KeyCode.KEY_A, 'A');
36-
assertUSLabelWithoutModifiers(OperatingSystem.Windows, KeyMod.Alt | KeyCode.KEY_A, 'A');
37-
assertUSLabelWithoutModifiers(OperatingSystem.Windows, KeyMod.WinCtrl | KeyCode.KEY_A, 'A');
3828

3929
// two modifiers
4030
assertUSLabel(OperatingSystem.Windows, KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_A, 'Ctrl+Shift+A');
@@ -43,46 +33,29 @@ suite('KeybindingLabels', () => {
4333
assertUSLabel(OperatingSystem.Windows, KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_A, 'Shift+Alt+A');
4434
assertUSLabel(OperatingSystem.Windows, KeyMod.Shift | KeyMod.WinCtrl | KeyCode.KEY_A, 'Shift+Windows+A');
4535
assertUSLabel(OperatingSystem.Windows, KeyMod.Alt | KeyMod.WinCtrl | KeyCode.KEY_A, 'Alt+Windows+A');
46-
assertUSLabelWithoutModifiers(OperatingSystem.Windows, KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_A, 'A');
47-
assertUSLabelWithoutModifiers(OperatingSystem.Windows, KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_A, 'A');
48-
assertUSLabelWithoutModifiers(OperatingSystem.Windows, KeyMod.CtrlCmd | KeyMod.WinCtrl | KeyCode.KEY_A, 'A');
49-
assertUSLabelWithoutModifiers(OperatingSystem.Windows, KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_A, 'A');
50-
assertUSLabelWithoutModifiers(OperatingSystem.Windows, KeyMod.Shift | KeyMod.WinCtrl | KeyCode.KEY_A, 'A');
51-
assertUSLabelWithoutModifiers(OperatingSystem.Windows, KeyMod.Alt | KeyMod.WinCtrl | KeyCode.KEY_A, 'A');
5236

5337
// three modifiers
5438
assertUSLabel(OperatingSystem.Windows, KeyMod.CtrlCmd | KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_A, 'Ctrl+Shift+Alt+A');
5539
assertUSLabel(OperatingSystem.Windows, KeyMod.CtrlCmd | KeyMod.Shift | KeyMod.WinCtrl | KeyCode.KEY_A, 'Ctrl+Shift+Windows+A');
5640
assertUSLabel(OperatingSystem.Windows, KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.WinCtrl | KeyCode.KEY_A, 'Ctrl+Alt+Windows+A');
5741
assertUSLabel(OperatingSystem.Windows, KeyMod.Shift | KeyMod.Alt | KeyMod.WinCtrl | KeyCode.KEY_A, 'Shift+Alt+Windows+A');
58-
assertUSLabelWithoutModifiers(OperatingSystem.Windows, KeyMod.CtrlCmd | KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_A, 'A');
59-
assertUSLabelWithoutModifiers(OperatingSystem.Windows, KeyMod.CtrlCmd | KeyMod.Shift | KeyMod.WinCtrl | KeyCode.KEY_A, 'A');
60-
assertUSLabelWithoutModifiers(OperatingSystem.Windows, KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.WinCtrl | KeyCode.KEY_A, 'A');
61-
assertUSLabelWithoutModifiers(OperatingSystem.Windows, KeyMod.Shift | KeyMod.Alt | KeyMod.WinCtrl | KeyCode.KEY_A, 'A');
6242

6343
// four modifiers
6444
assertUSLabel(OperatingSystem.Windows, KeyMod.CtrlCmd | KeyMod.Shift | KeyMod.Alt | KeyMod.WinCtrl | KeyCode.KEY_A, 'Ctrl+Shift+Alt+Windows+A');
65-
assertUSLabelWithoutModifiers(OperatingSystem.Windows, KeyMod.CtrlCmd | KeyMod.Shift | KeyMod.Alt | KeyMod.WinCtrl | KeyCode.KEY_A, 'A');
6645

6746
// chord
6847
assertUSLabel(OperatingSystem.Windows, KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_A, KeyMod.CtrlCmd | KeyCode.KEY_B), 'Ctrl+A Ctrl+B');
69-
assertUSLabelWithoutModifiers(OperatingSystem.Windows, KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_A, KeyMod.CtrlCmd | KeyCode.KEY_B), 'A B');
7048
});
7149

7250
test('Linux US label', () => {
7351
// no modifier
7452
assertUSLabel(OperatingSystem.Linux, KeyCode.KEY_A, 'A');
75-
assertUSLabelWithoutModifiers(OperatingSystem.Linux, KeyCode.KEY_A, 'A');
7653

7754
// one modifier
7855
assertUSLabel(OperatingSystem.Linux, KeyMod.CtrlCmd | KeyCode.KEY_A, 'Ctrl+A');
7956
assertUSLabel(OperatingSystem.Linux, KeyMod.Shift | KeyCode.KEY_A, 'Shift+A');
8057
assertUSLabel(OperatingSystem.Linux, KeyMod.Alt | KeyCode.KEY_A, 'Alt+A');
8158
assertUSLabel(OperatingSystem.Linux, KeyMod.WinCtrl | KeyCode.KEY_A, 'Windows+A');
82-
assertUSLabelWithoutModifiers(OperatingSystem.Linux, KeyMod.CtrlCmd | KeyCode.KEY_A, 'A');
83-
assertUSLabelWithoutModifiers(OperatingSystem.Linux, KeyMod.Shift | KeyCode.KEY_A, 'A');
84-
assertUSLabelWithoutModifiers(OperatingSystem.Linux, KeyMod.Alt | KeyCode.KEY_A, 'A');
85-
assertUSLabelWithoutModifiers(OperatingSystem.Linux, KeyMod.WinCtrl | KeyCode.KEY_A, 'A');
8659

8760
// two modifiers
8861
assertUSLabel(OperatingSystem.Linux, KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_A, 'Ctrl+Shift+A');
@@ -91,46 +64,29 @@ suite('KeybindingLabels', () => {
9164
assertUSLabel(OperatingSystem.Linux, KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_A, 'Shift+Alt+A');
9265
assertUSLabel(OperatingSystem.Linux, KeyMod.Shift | KeyMod.WinCtrl | KeyCode.KEY_A, 'Shift+Windows+A');
9366
assertUSLabel(OperatingSystem.Linux, KeyMod.Alt | KeyMod.WinCtrl | KeyCode.KEY_A, 'Alt+Windows+A');
94-
assertUSLabelWithoutModifiers(OperatingSystem.Linux, KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_A, 'A');
95-
assertUSLabelWithoutModifiers(OperatingSystem.Linux, KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_A, 'A');
96-
assertUSLabelWithoutModifiers(OperatingSystem.Linux, KeyMod.CtrlCmd | KeyMod.WinCtrl | KeyCode.KEY_A, 'A');
97-
assertUSLabelWithoutModifiers(OperatingSystem.Linux, KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_A, 'A');
98-
assertUSLabelWithoutModifiers(OperatingSystem.Linux, KeyMod.Shift | KeyMod.WinCtrl | KeyCode.KEY_A, 'A');
99-
assertUSLabelWithoutModifiers(OperatingSystem.Linux, KeyMod.Alt | KeyMod.WinCtrl | KeyCode.KEY_A, 'A');
10067

10168
// three modifiers
10269
assertUSLabel(OperatingSystem.Linux, KeyMod.CtrlCmd | KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_A, 'Ctrl+Shift+Alt+A');
10370
assertUSLabel(OperatingSystem.Linux, KeyMod.CtrlCmd | KeyMod.Shift | KeyMod.WinCtrl | KeyCode.KEY_A, 'Ctrl+Shift+Windows+A');
10471
assertUSLabel(OperatingSystem.Linux, KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.WinCtrl | KeyCode.KEY_A, 'Ctrl+Alt+Windows+A');
10572
assertUSLabel(OperatingSystem.Linux, KeyMod.Shift | KeyMod.Alt | KeyMod.WinCtrl | KeyCode.KEY_A, 'Shift+Alt+Windows+A');
106-
assertUSLabelWithoutModifiers(OperatingSystem.Linux, KeyMod.CtrlCmd | KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_A, 'A');
107-
assertUSLabelWithoutModifiers(OperatingSystem.Linux, KeyMod.CtrlCmd | KeyMod.Shift | KeyMod.WinCtrl | KeyCode.KEY_A, 'A');
108-
assertUSLabelWithoutModifiers(OperatingSystem.Linux, KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.WinCtrl | KeyCode.KEY_A, 'A');
109-
assertUSLabelWithoutModifiers(OperatingSystem.Linux, KeyMod.Shift | KeyMod.Alt | KeyMod.WinCtrl | KeyCode.KEY_A, 'A');
11073

11174
// four modifiers
11275
assertUSLabel(OperatingSystem.Linux, KeyMod.CtrlCmd | KeyMod.Shift | KeyMod.Alt | KeyMod.WinCtrl | KeyCode.KEY_A, 'Ctrl+Shift+Alt+Windows+A');
113-
assertUSLabelWithoutModifiers(OperatingSystem.Linux, KeyMod.CtrlCmd | KeyMod.Shift | KeyMod.Alt | KeyMod.WinCtrl | KeyCode.KEY_A, 'A');
11476

11577
// chord
11678
assertUSLabel(OperatingSystem.Linux, KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_A, KeyMod.CtrlCmd | KeyCode.KEY_B), 'Ctrl+A Ctrl+B');
117-
assertUSLabelWithoutModifiers(OperatingSystem.Linux, KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_A, KeyMod.CtrlCmd | KeyCode.KEY_B), 'A B');
11879
});
11980

12081
test('Mac US label', () => {
12182
// no modifier
12283
assertUSLabel(OperatingSystem.Macintosh, KeyCode.KEY_A, 'A');
123-
assertUSLabelWithoutModifiers(OperatingSystem.Macintosh, KeyCode.KEY_A, 'A');
12484

12585
// one modifier
12686
assertUSLabel(OperatingSystem.Macintosh, KeyMod.CtrlCmd | KeyCode.KEY_A, '⌘A');
12787
assertUSLabel(OperatingSystem.Macintosh, KeyMod.Shift | KeyCode.KEY_A, '⇧A');
12888
assertUSLabel(OperatingSystem.Macintosh, KeyMod.Alt | KeyCode.KEY_A, '⌥A');
12989
assertUSLabel(OperatingSystem.Macintosh, KeyMod.WinCtrl | KeyCode.KEY_A, '⌃A');
130-
assertUSLabelWithoutModifiers(OperatingSystem.Macintosh, KeyMod.CtrlCmd | KeyCode.KEY_A, 'A');
131-
assertUSLabelWithoutModifiers(OperatingSystem.Macintosh, KeyMod.Shift | KeyCode.KEY_A, 'A');
132-
assertUSLabelWithoutModifiers(OperatingSystem.Macintosh, KeyMod.Alt | KeyCode.KEY_A, 'A');
133-
assertUSLabelWithoutModifiers(OperatingSystem.Macintosh, KeyMod.WinCtrl | KeyCode.KEY_A, 'A');
13490

13591
// two modifiers
13692
assertUSLabel(OperatingSystem.Macintosh, KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_A, '⇧⌘A');
@@ -139,30 +95,18 @@ suite('KeybindingLabels', () => {
13995
assertUSLabel(OperatingSystem.Macintosh, KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_A, '⇧⌥A');
14096
assertUSLabel(OperatingSystem.Macintosh, KeyMod.Shift | KeyMod.WinCtrl | KeyCode.KEY_A, '⌃⇧A');
14197
assertUSLabel(OperatingSystem.Macintosh, KeyMod.Alt | KeyMod.WinCtrl | KeyCode.KEY_A, '⌃⌥A');
142-
assertUSLabelWithoutModifiers(OperatingSystem.Macintosh, KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_A, 'A');
143-
assertUSLabelWithoutModifiers(OperatingSystem.Macintosh, KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_A, 'A');
144-
assertUSLabelWithoutModifiers(OperatingSystem.Macintosh, KeyMod.CtrlCmd | KeyMod.WinCtrl | KeyCode.KEY_A, 'A');
145-
assertUSLabelWithoutModifiers(OperatingSystem.Macintosh, KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_A, 'A');
146-
assertUSLabelWithoutModifiers(OperatingSystem.Macintosh, KeyMod.Shift | KeyMod.WinCtrl | KeyCode.KEY_A, 'A');
147-
assertUSLabelWithoutModifiers(OperatingSystem.Macintosh, KeyMod.Alt | KeyMod.WinCtrl | KeyCode.KEY_A, 'A');
14898

14999
// three modifiers
150100
assertUSLabel(OperatingSystem.Macintosh, KeyMod.CtrlCmd | KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_A, '⇧⌥⌘A');
151101
assertUSLabel(OperatingSystem.Macintosh, KeyMod.CtrlCmd | KeyMod.Shift | KeyMod.WinCtrl | KeyCode.KEY_A, '⌃⇧⌘A');
152102
assertUSLabel(OperatingSystem.Macintosh, KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.WinCtrl | KeyCode.KEY_A, '⌃⌥⌘A');
153103
assertUSLabel(OperatingSystem.Macintosh, KeyMod.Shift | KeyMod.Alt | KeyMod.WinCtrl | KeyCode.KEY_A, '⌃⇧⌥A');
154-
assertUSLabelWithoutModifiers(OperatingSystem.Macintosh, KeyMod.CtrlCmd | KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_A, 'A');
155-
assertUSLabelWithoutModifiers(OperatingSystem.Macintosh, KeyMod.CtrlCmd | KeyMod.Shift | KeyMod.WinCtrl | KeyCode.KEY_A, 'A');
156-
assertUSLabelWithoutModifiers(OperatingSystem.Macintosh, KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.WinCtrl | KeyCode.KEY_A, 'A');
157-
assertUSLabelWithoutModifiers(OperatingSystem.Macintosh, KeyMod.Shift | KeyMod.Alt | KeyMod.WinCtrl | KeyCode.KEY_A, 'A');
158104

159105
// four modifiers
160106
assertUSLabel(OperatingSystem.Macintosh, KeyMod.CtrlCmd | KeyMod.Shift | KeyMod.Alt | KeyMod.WinCtrl | KeyCode.KEY_A, '⌃⇧⌥⌘A');
161-
assertUSLabelWithoutModifiers(OperatingSystem.Macintosh, KeyMod.CtrlCmd | KeyMod.Shift | KeyMod.Alt | KeyMod.WinCtrl | KeyCode.KEY_A, 'A');
162107

163108
// chord
164109
assertUSLabel(OperatingSystem.Macintosh, KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_A, KeyMod.CtrlCmd | KeyCode.KEY_B), '⌘A ⌘B');
165-
assertUSLabelWithoutModifiers(OperatingSystem.Macintosh, KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_A, KeyMod.CtrlCmd | KeyCode.KEY_B), 'A B');
166110

167111
// special keys
168112
assertUSLabel(OperatingSystem.Macintosh, KeyCode.LeftArrow, '←');
@@ -176,17 +120,10 @@ suite('KeybindingLabels', () => {
176120
const usResolvedKeybinding = new USLayoutResolvedKeybinding(createKeybinding(keybinding, OS), OS);
177121
assert.equal(usResolvedKeybinding.getAriaLabel(), expected);
178122
}
179-
function assertAriaLabelWithoutModifiers(OS: OperatingSystem, keybinding: number, expected: string): void {
180-
const usResolvedKeybinding = new USLayoutResolvedKeybinding(createKeybinding(keybinding, OS), OS);
181-
assert.equal(usResolvedKeybinding.getAriaLabelWithoutModifiers(), expected);
182-
}
183123

184124
assertAriaLabel(OperatingSystem.Windows, KeyMod.CtrlCmd | KeyMod.Shift | KeyMod.Alt | KeyMod.WinCtrl | KeyCode.KEY_A, 'Control+Shift+Alt+Windows+A');
185125
assertAriaLabel(OperatingSystem.Linux, KeyMod.CtrlCmd | KeyMod.Shift | KeyMod.Alt | KeyMod.WinCtrl | KeyCode.KEY_A, 'Control+Shift+Alt+Windows+A');
186126
assertAriaLabel(OperatingSystem.Macintosh, KeyMod.CtrlCmd | KeyMod.Shift | KeyMod.Alt | KeyMod.WinCtrl | KeyCode.KEY_A, 'Control+Shift+Alt+Command+A');
187-
assertAriaLabelWithoutModifiers(OperatingSystem.Windows, KeyMod.CtrlCmd | KeyMod.Shift | KeyMod.Alt | KeyMod.WinCtrl | KeyCode.KEY_A, 'A');
188-
assertAriaLabelWithoutModifiers(OperatingSystem.Linux, KeyMod.CtrlCmd | KeyMod.Shift | KeyMod.Alt | KeyMod.WinCtrl | KeyCode.KEY_A, 'A');
189-
assertAriaLabelWithoutModifiers(OperatingSystem.Macintosh, KeyMod.CtrlCmd | KeyMod.Shift | KeyMod.Alt | KeyMod.WinCtrl | KeyCode.KEY_A, 'A');
190127
});
191128

192129
test('Electron Accelerator label', () => {

src/vs/workbench/browser/parts/editor/editorPicker.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,13 @@ export abstract class EditorGroupPicker extends BaseEditorPicker {
198198
return super.getAutoFocus(searchValue);
199199
}
200200

201-
const isShiftNavigate = (quickNavigateConfiguration && quickNavigateConfiguration.keybindings.some(k => !k.isChord() && k.hasShiftModifier()));
201+
const isShiftNavigate = (quickNavigateConfiguration && quickNavigateConfiguration.keybindings.some(k => {
202+
const [firstPart, chordPart] = k.getParts();
203+
if (chordPart) {
204+
return false;
205+
}
206+
return firstPart.shiftKey;
207+
}));
202208
if (isShiftNavigate) {
203209
return {
204210
autoFocusLastEntry: true

0 commit comments

Comments
 (0)