abstractKeybindingService.ts ×7

Frontier kind: Code frontier

unlabeled · c_a674a682a2ea

11 tests · 11810 LOC · 57 files · introduces 0 tests · 22 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
7 ranges22 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1697 ranges11810 lines · 57 files · Browse complete extent
All tests (intent)
11 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: 22 introduced LOC across 7 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/keybinding/common/abstractKeybindingService.ts 22 introduced LOC · 7 ranges

Open complete file

220
221 protected _dispatch(e: IKeyboardEvent, target: IContextKeyServiceTarget): boolean {
222 > return this._doDispatch(this.resolveKeyboardEvent(e), target, /*isSingleModiferChord*/false); abstractKeybindingService.ts
223 > }
224
225 protected _singleModifierDispatch(e: IKeyboardEvent, target: IContextKeyServiceTarget): boolean {
278
279 private _doDispatch(userKeypress: ResolvedKeybinding, target: IContextKeyServiceTarget, isSingleModiferChord = false): boolean {
280 > let shouldPreventDefault = false; abstractKeybindingService.ts
281 >
282 > if (userKeypress.hasMultipleChords()) { // warn - because user can press a single chord at a time
283 console.warn('Unexpected keyboard event mapped to multiple chords');
284 return false;
285 }
287 > let userPressedChord: string | null = null;
288 > let currentChords: string[] | null = null;
289 >
290 > if (isSingleModiferChord) {
291 // The keybinding is the second keypress of a single modifier chord, e.g. "shift shift".
292 // A single modifier can only occur when the same modifier is pressed in short sequence,
295 userPressedChord = dispatchKeyname;
296 currentChords = dispatchKeyname ? [dispatchKeyname] : []; // TODO@ulugbekna: in the `else` case we assign an empty array - make sure `resolve` can handle an empty array well
298 > [userPressedChord,] = userKeypress.getDispatchChords();
299 > currentChords = this._currentChords.map(({ keypress }) => keypress);
300 > }
301 >
302 > if (userPressedChord === null) {
303 this._log(`\\ Keyboard event cannot be dispatched in keydown phase.`);
304 // cannot be dispatched, probably only modifier keys
327 return shouldPreventDefault;
328 }
330 > case ResultKind.MoreChordsNeeded: {
331
332 this._logService.trace('KeybindingService#dispatch', keypressLabel, `[ Several keybindings match - more chords needed ]`);
337 return shouldPreventDefault;
338 }
340 > case ResultKind.KbFound: {
341
342 this._logService.trace('KeybindingService#dispatch', keypressLabel, `[ Will dispatch command ${resolveResult.commandId} ]`);
380 return shouldPreventDefault;
381 }
383 > }
384
385 abstract enableKeybindingHoldMode(commandId: string): Promise<void> | undefined;