diff --git a/src/vs/platform/list/browser/listService.ts b/src/vs/platform/list/browser/listService.ts index f4101fac8a2d44c6f2431ab15a34e9fd4ce668d7..9bd6cae45877d43aeed667c9527a690eaa8a22c1 100644 --- a/src/vs/platform/list/browser/listService.ts +++ b/src/vs/platform/list/browser/listService.ts @@ -654,19 +654,21 @@ export class HighlightingWorkbenchTree extends WorkbenchTree { this.input.onDidChange(this.updateHighlights, this, this.disposables); this.disposables.push(attachInputBoxStyler(this.input, themeService)); this.disposables.push(this.input); - this.disposables.push(addStandardDisposableListener(this.input.inputElement, 'keyup', event => { + this.disposables.push(addStandardDisposableListener(this.input.inputElement, 'keydown', event => { //todo@joh make this command/context-key based - if (event.keyCode === KeyCode.DownArrow) { - this.focusNext(); - this.domFocus(); - } else if (event.keyCode === KeyCode.UpArrow) { - this.focusPrevious(); - this.domFocus(); - } else if (event.keyCode === KeyCode.Enter) { - this.setSelection(this.getSelection()); - } else if (event.keyCode === KeyCode.Escape) { - this.input.value = ''; - this.domFocus(); + switch (event.keyCode) { + case KeyCode.DownArrow: + case KeyCode.UpArrow: + this.domFocus(); + break; + case KeyCode.Enter: + case KeyCode.Tab: + this.setSelection(this.getSelection()); + break; + case KeyCode.Escape: + this.input.value = ''; + this.domFocus(); + break; } })); } diff --git a/src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts b/src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts index 05d95f480429decec3fba74209a3465e2068815e..4cb6d9a0dc0755405ac677b41b56ce238cd50699 100644 --- a/src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts +++ b/src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts @@ -37,6 +37,8 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService'; import { MenuRegistry, MenuId } from 'vs/platform/actions/common/actions'; import { localize } from 'vs/nls'; +import { WorkbenchListFocusContextKey, IListService } from 'vs/platform/list/browser/listService'; +import { Tree } from 'vs/base/parts/tree/browser/treeImpl'; class Item extends BreadcrumbsItem { @@ -414,5 +416,16 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ groups.activeGroup.activeControl.focus(); } }); - +KeybindingsRegistry.registerCommandAndKeybindingRule({ + id: 'breadcrumbs.pickFromTree', + weight: KeybindingsRegistry.WEIGHT.workbenchContrib(), + primary: KeyCode.Tab, + when: ContextKeyExpr.and(BreadcrumbsControl.CK_BreadcrumbsVisible, BreadcrumbsControl.CK_BreadcrumbsActive, WorkbenchListFocusContextKey), + handler(accessor) { + const list = accessor.get(IListService).lastFocusedList; + if (list instanceof Tree) { + list.setSelection([list.getFocus()]); + } + } +}); //#endregion