mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-02 17:23:40 -05:00
Merge from vscode bead496a613e475819f89f08e9e882b841bc1fe8 (#14883)
* Merge from vscode bead496a613e475819f89f08e9e882b841bc1fe8 * Bump distro * Upgrade GCC to 4.9 due to yarn install errors * Update build image * Fix bootstrap base url * Bump distro * Fix build errors * Update source map file * Disable checkbox for blocking migration issues (#15131) * disable checkbox for blocking issues * wip * disable checkbox fixes * fix strings * Remove duplicate tsec command * Default to off for tab color if settings not present * re-skip failing tests * Fix mocha error * Bump sqlite version & fix notebooks search view * Turn off esbuild warnings * Update esbuild log level * Fix overflowactionbar tests * Fix ts-ignore in dropdown tests * cleanup/fixes * Fix hygiene * Bundle in entire zone.js module * Remove extra constructor param * bump distro for web compile break * bump distro for web compile break v2 * Undo log level change * New distro * Fix integration test scripts * remove the "no yarn.lock changes" workflow * fix scripts v2 * Update unit test scripts * Ensure ads-kerberos2 updates in .vscodeignore * Try fix unit tests * Upload crash reports * remove nogpu * always upload crashes * Use bash script * Consolidate data/ext dir names * Create in tmp directory Co-authored-by: chlafreniere <hichise@gmail.com> Co-authored-by: Christopher Suh <chsuh@microsoft.com> Co-authored-by: chgagnon <chgagnon@microsoft.com>
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
import * as nls from 'vs/nls';
|
||||
import * as arrays from 'vs/base/common/arrays';
|
||||
import { IntervalTimer } from 'vs/base/common/async';
|
||||
import { IntervalTimer, TimeoutTimer } from 'vs/base/common/async';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { KeyCode, Keybinding, ResolvedKeybinding } from 'vs/base/common/keyCodes';
|
||||
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
|
||||
@@ -35,6 +35,9 @@ export abstract class AbstractKeybindingService extends Disposable implements IK
|
||||
private _currentChord: CurrentChord | null;
|
||||
private _currentChordChecker: IntervalTimer;
|
||||
private _currentChordStatusMessage: IDisposable | null;
|
||||
private _currentSingleModifier: null | string;
|
||||
private _currentSingleModifierClearTimeout: TimeoutTimer;
|
||||
|
||||
protected _logging: boolean;
|
||||
|
||||
public get inChordMode(): boolean {
|
||||
@@ -53,6 +56,8 @@ export abstract class AbstractKeybindingService extends Disposable implements IK
|
||||
this._currentChord = null;
|
||||
this._currentChordChecker = new IntervalTimer();
|
||||
this._currentChordStatusMessage = null;
|
||||
this._currentSingleModifier = null;
|
||||
this._currentSingleModifierClearTimeout = new TimeoutTimer();
|
||||
this._logging = false;
|
||||
}
|
||||
|
||||
@@ -166,30 +171,69 @@ export abstract class AbstractKeybindingService extends Disposable implements IK
|
||||
public dispatchByUserSettingsLabel(userSettingsLabel: string, target: IContextKeyServiceTarget): void {
|
||||
const keybindings = this.resolveUserBinding(userSettingsLabel);
|
||||
if (keybindings.length >= 1) {
|
||||
this._doDispatch(keybindings[0], target);
|
||||
this._doDispatch(keybindings[0], target, /*isSingleModiferChord*/false);
|
||||
}
|
||||
}
|
||||
|
||||
protected _dispatch(e: IKeyboardEvent, target: IContextKeyServiceTarget): boolean {
|
||||
return this._doDispatch(this.resolveKeyboardEvent(e), target);
|
||||
return this._doDispatch(this.resolveKeyboardEvent(e), target, /*isSingleModiferChord*/false);
|
||||
}
|
||||
|
||||
private _doDispatch(keybinding: ResolvedKeybinding, target: IContextKeyServiceTarget): boolean {
|
||||
protected _singleModifierDispatch(e: IKeyboardEvent, target: IContextKeyServiceTarget): boolean {
|
||||
const keybinding = this.resolveKeyboardEvent(e);
|
||||
const [singleModifier,] = keybinding.getSingleModifierDispatchParts();
|
||||
|
||||
if (singleModifier !== null && this._currentSingleModifier === null) {
|
||||
// we have a valid `singleModifier`, store it for the next keyup, but clear it in 300ms
|
||||
this._log(`+ Storing single modifier for possible chord ${singleModifier}.`);
|
||||
this._currentSingleModifier = singleModifier;
|
||||
this._currentSingleModifierClearTimeout.cancelAndSet(() => {
|
||||
this._log(`+ Clearing single modifier due to 300ms elapsed.`);
|
||||
this._currentSingleModifier = null;
|
||||
}, 300);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (singleModifier !== null && singleModifier === this._currentSingleModifier) {
|
||||
// bingo!
|
||||
this._log(`/ Dispatching single modifier chord ${singleModifier} ${singleModifier}`);
|
||||
this._currentSingleModifierClearTimeout.cancel();
|
||||
this._currentSingleModifier = null;
|
||||
return this._doDispatch(keybinding, target, /*isSingleModiferChord*/true);
|
||||
}
|
||||
|
||||
this._currentSingleModifierClearTimeout.cancel();
|
||||
this._currentSingleModifier = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
private _doDispatch(keybinding: ResolvedKeybinding, target: IContextKeyServiceTarget, isSingleModiferChord = false): boolean {
|
||||
let shouldPreventDefault = false;
|
||||
|
||||
if (keybinding.isChord()) {
|
||||
console.warn('Unexpected keyboard event mapped to a chord');
|
||||
return false;
|
||||
}
|
||||
const [firstPart,] = keybinding.getDispatchParts();
|
||||
|
||||
let firstPart: string | null = null; // the first keybinding i.e. Ctrl+K
|
||||
let currentChord: string | null = null;// the "second" keybinding i.e. Ctrl+K "Ctrl+D"
|
||||
|
||||
if (isSingleModiferChord) {
|
||||
const [dispatchKeyname,] = keybinding.getSingleModifierDispatchParts();
|
||||
firstPart = dispatchKeyname;
|
||||
currentChord = dispatchKeyname;
|
||||
} else {
|
||||
[firstPart,] = keybinding.getDispatchParts();
|
||||
currentChord = this._currentChord ? this._currentChord.keypress : null;
|
||||
}
|
||||
|
||||
if (firstPart === null) {
|
||||
this._log(`\\ Keyboard event cannot be dispatched.`);
|
||||
this._log(`\\ Keyboard event cannot be dispatched in keydown phase.`);
|
||||
// cannot be dispatched, probably only modifier keys
|
||||
return shouldPreventDefault;
|
||||
}
|
||||
|
||||
const contextValue = this._contextKeyService.getContext(target);
|
||||
const currentChord = this._currentChord ? this._currentChord.keypress : null;
|
||||
const keypressLabel = keybinding.getLabel();
|
||||
const resolveResult = this._getResolver().resolve(contextValue, currentChord, firstPart);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user