Skip to content

Commit

Permalink
quick-open: Esc closes inputbox when focus out.
Browse files Browse the repository at this point in the history
Closes: 6773

Signed-Off-By: FernandoAscencio <fernando.ascencio.cama@ericsson.com>
Co-Authored-By: vince-fugnitto <vincent.fugnitto@ericsson.com>
  • Loading branch information
FernandoAscencio and vince-fugnitto committed May 15, 2023
1 parent 3eb7137 commit d61114d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { injectable, inject, optional } from 'inversify';
import { CommandRegistry, CommandContribution, MenuContribution, MenuModelRegistry, nls } from '../../common';
import { KeybindingRegistry, KeybindingContribution } from '../keybinding';
import { CommonMenus } from '../common-frontend-contribution';
import { CLEAR_COMMAND_HISTORY, quickCommand, QuickCommandService } from './quick-command-service';
import { CLOSE_QUICK_OPEN, CLEAR_COMMAND_HISTORY, quickCommand, QuickCommandService } from './quick-command-service';
import { QuickInputService } from './quick-input-service';
import { ConfirmDialog, Dialog } from '../dialogs';

Expand Down Expand Up @@ -49,6 +49,9 @@ export class QuickCommandFrontendContribution implements CommandContribution, Ke
}
}
});
commands.registerCommand(CLOSE_QUICK_OPEN, {
execute: () => this.quickInputService?.hide()
});
}

registerMenus(menus: MenuModelRegistry): void {
Expand All @@ -67,5 +70,15 @@ export class QuickCommandFrontendContribution implements CommandContribution, Ke
command: quickCommand.id,
keybinding: 'ctrlcmd+shift+p'
});
keybindings.registerKeybinding({
command: CLOSE_QUICK_OPEN.id,
keybinding: 'esc',
when: 'inQuickOpen'
});
keybindings.registerKeybinding({
command: CLOSE_QUICK_OPEN.id,
keybinding: 'shift+esc',
when: 'inQuickOpen'
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ export const CLEAR_COMMAND_HISTORY = Command.toDefaultLocalizedCommand({
label: 'Clear Command History'
});

export const CLOSE_QUICK_OPEN: Command = {
id: 'workbench.action.closeQuickOpen'
};

@injectable()
export class QuickCommandService implements QuickAccessContribution, QuickAccessProvider {
static PREFIX = '>';
Expand Down

0 comments on commit d61114d

Please sign in to comment.