keybindingLabels.ts ×10

Frontier kind: Code frontier

unlabeled · c_52c8df0f9a5d

160 tests · 4586 LOC · 23 files · introduces 0 tests · 30 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
10 ranges30 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
544 ranges4586 lines · 23 files · Browse complete extent
All tests (intent)
160 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: 30 introduced LOC across 10 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/base/common/keybindingLabels.ts 30 introduced LOC · 10 ranges

Open complete file

32
33 public toLabel<T extends Modifiers>(OS: OperatingSystem, chords: readonly T[], keyLabelProvider: KeyLabelProvider<T>): string | null {
34 > if (chords.length === 0) { keybindingLabels.ts
35 return null;
36 }
38 > const result: string[] = [];
39 > for (let i = 0, len = chords.length; i < len; i++) {
40 > const chord = chords[i];
41 > const keyLabel = keyLabelProvider(chord);
42 > if (keyLabel === null) {
43 // this keybinding cannot be expressed...
44 return null;
45 }
46 > result[i] = _simpleAsString(chord, keyLabel, this.modifierLabels[OS]); keybindingLabels.ts
47 > }
48 > return result.join(' ');
49 > }
50 }
51
152 );
153
154 > function _simpleAsString(modifiers: Modifiers, key: string, labels: ModifierLabels): string { keybindingLabels.ts
155 > if (key === null) {
156 return '';
157 }
159 > const result: string[] = [];
160 >
161 > // translate modifier keys: Ctrl-Shift-Alt-Meta
162 > if (modifiers.ctrlKey) {
163 result.push(labels.ctrlKey);
164 }
166 > if (modifiers.shiftKey) {
167 result.push(labels.shiftKey);
168 }
170 > if (modifiers.altKey) {
171 result.push(labels.altKey);
172 }
174 > if (modifiers.metaKey) {
175 result.push(labels.metaKey);
176 }
178 > // the actual key
179 > if (key !== '') {
180 result.push(key);
181 }
183 > return result.join(labels.separator);
184 > }