keybindingsMerge.ts ×12

Frontier kind: Joint frontier

unlabeled · c_f28bd1df17bb

2 tests · 22528 LOC · 133 files · introduces 1 test · 44 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
12 ranges44 lines · 1 files
Tests
1 test

Contains — complete concept membership

All code (extent)
3251 ranges22528 lines · 133 files · Browse complete extent
All tests (intent)
2 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.

1 test introduced at this concept.

Introduced code

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

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

src/vs/platform/userDataSync/common/keybindingsMerge.ts 44 introduced LOC · 12 ranges

Open complete file

69 // Removed commands in Remote
70 for (const command of commandsMergeResult.removed.values()) {
71 > if (commandsMergeResult.conflicts.has(command)) { keybindingsMerge.ts
72 continue;
73 }
74 > mergeContent = removeKeybindings(mergeContent, command, formattingOptions); keybindingsMerge.ts
75 > }
76
77 // Added commands in remote
91 // Updated commands in Remote
92 for (const command of commandsMergeResult.updated.values()) {
93 > if (commandsMergeResult.conflicts.has(command)) { keybindingsMerge.ts
94 continue;
95 }
96 > const keybindings = remoteByCommand.get(command)!; keybindingsMerge.ts
97 > // Ignore negated commands
98 > if (keybindings.some(keybinding => keybinding.command !== `-${command}` && keybindingsMergeResult.conflicts.has(normalizedKeys[keybinding.key]))) {
99 commandsMergeResult.conflicts.add(command);
100 continue;
101 }
102 > mergeContent = updateKeybindings(mergeContent, command, keybindings, formattingOptions); keybindingsMerge.ts
103 > }
104
105 return { mergeContent, hasChanges: true, hasConflicts: commandsMergeResult.conflicts.size > 0 };
169 continue;
170 }
171 > // Got updated in remote keybindingsMerge.ts
172 > if (baseToRemote.updated.has(key)) {
173 > // Has different value
174 > if (localToRemote.updated.has(key)) {
175 conflicts.add(key);
176 }
178 }
179
183 continue;
184 }
185 > // Got updated in local keybindingsMerge.ts
186 > if (baseToLocal.updated.has(key)) {
187 > // Has different value
188 > if (localToRemote.updated.has(key)) {
189 conflicts.add(key);
190 }
191 > } else { keybindingsMerge.ts
192 > // updated key
193 > updated.add(key);
194 > }
195 }
196 return { added, removed, updated, conflicts };
335 }
336
337 > function removeKeybindings(content: string, command: string, formattingOptions: FormattingOptions): string { keybindingsMerge.ts
338 > const keybindings = parseKeybindings(content);
339 > for (let index = keybindings.length - 1; index >= 0; index--) {
340 > if (keybindings[index].command === command || keybindings[index].command === `-${command}`) {
341 content = contentUtil.edit(content, [index], undefined, formattingOptions);
342 }
344 > return content;
345 > }
346
347 > function updateKeybindings(content: string, command: string, keybindings: IUserFriendlyKeybinding[], formattingOptions: FormattingOptions): string { keybindingsMerge.ts
348 > const allKeybindings = parseKeybindings(content);
349 > const location = allKeybindings.findIndex(keybinding => keybinding.command === command || keybinding.command === `-${command}`);
350 > // Remove all entries with this command
351 > for (let index = allKeybindings.length - 1; index >= 0; index--) {
352 > if (allKeybindings[index].command === command || allKeybindings[index].command === `-${command}`) {
353 > content = contentUtil.edit(content, [index], undefined, formattingOptions);
354 > }
355 > }
356 > // add all entries at the same location where the entry with this command was located.
357 > for (let index = keybindings.length - 1; index >= 0; index--) {
358 > content = contentUtil.edit(content, [location], keybindings[index], formattingOptions);
359 > }
360 > return content;
361 > }