keybindingResolver.ts ×6

Frontier kind: Code frontier

unlabeled · c_95a27965aabf

52 tests · 7464 LOC · 37 files · introduces 0 tests · 27 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
6 ranges27 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1085 ranges7464 lines · 37 files · Browse complete extent
All tests (intent)
52 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 27 introduced LOC across 6 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/keybinding/common/keybindingResolver.ts 27 introduced LOC · 6 ranges

Open complete file

49
50 constructor(
51 > /** built-in and extension-provided keybindings */ keybindingResolver.ts
52 > defaultKeybindings: ResolvedKeybindingItem[],
53 > /** user's keybindings */
54 > overrides: ResolvedKeybindingItem[],
55 > log: (str: string) => void
56 > ) {
57 > this._log = log;
58 > this._defaultKeybindings = defaultKeybindings;
59 >
60 > this._defaultBoundCommands = new Map<string, boolean>();
61 > for (const defaultKeybinding of defaultKeybindings) {
62 const command = defaultKeybinding.command;
63 if (command && command.charAt(0) !== '-') {
65 }
66 }
68 > this._map = new Map<string, ResolvedKeybindingItem[]>();
69 > this._lookupMap = new Map<string, ResolvedKeybindingItem[]>();
70 >
71 > this._keybindings = KeybindingResolver.handleRemovals(([] as ResolvedKeybindingItem[]).concat(defaultKeybindings).concat(overrides));
72 > for (let i = 0, len = this._keybindings.length; i < len; i++) {
73 const k = this._keybindings[i];
74 if (k.chords.length === 0) {
87 this._addKeyPress(k.chords[0], k);
88 }
90
91 private static _isTargetedForRemoval(defaultKb: ResolvedKeybindingItem, keypress: string[] | null, when: ContextKeyExpression | undefined): boolean {
123 */
124 public static handleRemovals(rules: ResolvedKeybindingItem[]): ResolvedKeybindingItem[] {
125 > // Do a first pass and construct a hash-map for removals keybindingResolver.ts
126 > const removals = new Map</* commandId */ string, ResolvedKeybindingItem[]>();
127 > for (let i = 0, len = rules.length; i < len; i++) {
128 const rule = rules[i];
129 if (rule.command && rule.command.charAt(0) === '-') {
136 }
137 }
139 > if (removals.size === 0) {
140 > // There are no removals
141 > return rules;
142 > }
143
144 // Do a second pass and keep only non-removed keybindings
173 }
174 return result;
176
177 private _addKeyPress(keypress: string, item: ResolvedKeybindingItem): void {