mirror of
https://github.com/Microsoft/vscode
synced 2024-10-05 19:02:54 +00:00
SCM - enable clearing the commit input using Escape (#214583)
This commit is contained in:
parent
6125cc2332
commit
af5696c630
|
@ -386,6 +386,22 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|||
}
|
||||
});
|
||||
|
||||
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
id: 'scm.clearInput',
|
||||
weight: KeybindingWeight.WorkbenchContrib,
|
||||
when: ContextKeyExpr.has('scmRepository'),
|
||||
primary: KeyCode.Escape,
|
||||
handler: async (accessor) => {
|
||||
const scmService = accessor.get(ISCMService);
|
||||
const contextKeyService = accessor.get(IContextKeyService);
|
||||
|
||||
const context = contextKeyService.getContext(getActiveElement());
|
||||
const repositoryId = context.getValue<string | undefined>('scmRepository');
|
||||
const repository = repositoryId ? scmService.getRepository(repositoryId) : undefined;
|
||||
repository?.input.setValue('', true);
|
||||
}
|
||||
});
|
||||
|
||||
const viewNextCommitCommand = {
|
||||
description: { description: localize('scm view next commit', "Source Control: View Next Commit"), args: [] },
|
||||
weight: KeybindingWeight.WorkbenchContrib,
|
||||
|
|
Loading…
Reference in a new issue