SCM - enable clearing the commit input using Escape (#214583)

This commit is contained in:
Ladislau Szomoru 2024-06-07 13:21:28 +02:00 committed by GitHub
parent 6125cc2332
commit af5696c630
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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,