fix: restore old behavior of not preventing default and not executing keybindings with empty command ID bound (#181920)

* abstractKeybindingService: fix: don't try executing keybindings with empty command IDs

* abstractKeybindingService: fix: restore old behavior that wouldn't prevent default if the keybinding has an empty command ID (unless the keybinding consists of more than one chord)
This commit is contained in:
Ulugbek Abdullaev 2023-05-10 11:38:18 +02:00 committed by GitHub
parent 331e290063
commit 6ec9831bf4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -342,17 +342,16 @@ export abstract class AbstractKeybindingService extends Disposable implements IK
this._logService.trace('KeybindingService#dispatch', keypressLabel, `[ Will dispatch command ${resolveResult.commandId} ]`);
if (resolveResult.commandId === null) {
if (resolveResult.commandId === null || resolveResult.commandId === '') {
if (this.inChordMode) {
const currentChordsLabel = this._currentChords.map(({ label }) => label).join(', ');
this._log(`+ Leaving chord mode: Nothing bound to "${currentChordsLabel}, ${keypressLabel}".`);
this._notificationService.status(nls.localize('missing.chord', "The key combination ({0}, {1}) is not a command.", currentChordsLabel, keypressLabel), { hideAfter: 10 * 1000 /* 10s */ });
this._leaveChordMode();
shouldPreventDefault = true;
}
shouldPreventDefault = true;
} else {
if (this.inChordMode) {
this._leaveChordMode();