diff options
author | Peng Lyu <penn.lv@gmail.com> | 2022-07-29 10:45:18 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-29 10:45:18 +0300 |
commit | e8ee2cf78ffe38e878fc0faa652f9515502fe58c (patch) | |
tree | 96a158ca2548299a53fc345fa53cdd50f74db37b | |
parent | 743b016722db90df977feecde0a4b3b4f58c2a4c (diff) |
Avoid List View default find widget steal keybindings. (#156637)
-rw-r--r-- | src/vs/platform/list/browser/listService.ts | 5 | ||||
-rw-r--r-- | src/vs/workbench/browser/actions/listCommands.ts | 4 | ||||
-rw-r--r-- | src/vs/workbench/contrib/preferences/browser/settingsTree.ts | 1 |
3 files changed, 8 insertions, 2 deletions
diff --git a/src/vs/platform/list/browser/listService.ts b/src/vs/platform/list/browser/listService.ts index 2bd9c44b14d..5af76e7958e 100644 --- a/src/vs/platform/list/browser/listService.ts +++ b/src/vs/platform/list/browser/listService.ts @@ -125,6 +125,7 @@ export const WorkbenchTreeElementHasParent = new RawContextKey<boolean>('treeEle export const WorkbenchTreeElementCanExpand = new RawContextKey<boolean>('treeElementCanExpand', false); export const WorkbenchTreeElementHasChild = new RawContextKey<boolean>('treeElementHasChild', false); export const WorkbenchTreeFindOpen = new RawContextKey<boolean>('treeFindOpen', false); +export const WorkbenchTreeSupportsFind = new RawContextKey<boolean>('treeSupportsFind', true); const WorkbenchListTypeNavigationModeKey = 'listTypeNavigationMode'; /** @@ -1143,6 +1144,7 @@ class WorkbenchTreeInternals<TInput, T, TFilterData> { private treeElementCanExpand: IContextKey<boolean>; private treeElementHasChild: IContextKey<boolean>; private treeFindOpen: IContextKey<boolean>; + private treeSupportFindWidget: IContextKey<boolean>; private _useAltAsMultipleSelectionModifier: boolean; private disposables: IDisposable[] = []; private styler: IDisposable | undefined; @@ -1176,7 +1178,10 @@ class WorkbenchTreeInternals<TInput, T, TFilterData> { this.treeElementHasParent = WorkbenchTreeElementHasParent.bindTo(this.contextKeyService); this.treeElementCanExpand = WorkbenchTreeElementCanExpand.bindTo(this.contextKeyService); this.treeElementHasChild = WorkbenchTreeElementHasChild.bindTo(this.contextKeyService); + this.treeFindOpen = WorkbenchTreeFindOpen.bindTo(this.contextKeyService); + this.treeSupportFindWidget = WorkbenchTreeSupportsFind.bindTo(this.contextKeyService); + this.treeSupportFindWidget.set(options.findWidgetEnabled ?? true); this._useAltAsMultipleSelectionModifier = useAltAsMultipleSelectionModifier(configurationService); diff --git a/src/vs/workbench/browser/actions/listCommands.ts b/src/vs/workbench/browser/actions/listCommands.ts index ee4848ce1ae..f6d73f19284 100644 --- a/src/vs/workbench/browser/actions/listCommands.ts +++ b/src/vs/workbench/browser/actions/listCommands.ts @@ -7,7 +7,7 @@ import { KeyMod, KeyCode } from 'vs/base/common/keyCodes'; import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { List } from 'vs/base/browser/ui/list/listWidget'; -import { WorkbenchListFocusContextKey, IListService, WorkbenchListSupportsMultiSelectContextKey, ListWidget, WorkbenchListHasSelectionOrFocus, getSelectionKeyboardEvent, WorkbenchListWidget, WorkbenchListSelectionNavigation, WorkbenchTreeElementCanCollapse, WorkbenchTreeElementHasParent, WorkbenchTreeElementHasChild, WorkbenchTreeElementCanExpand, RawWorkbenchListFocusContextKey, WorkbenchTreeFindOpen } from 'vs/platform/list/browser/listService'; +import { WorkbenchListFocusContextKey, IListService, WorkbenchListSupportsMultiSelectContextKey, ListWidget, WorkbenchListHasSelectionOrFocus, getSelectionKeyboardEvent, WorkbenchListWidget, WorkbenchListSelectionNavigation, WorkbenchTreeElementCanCollapse, WorkbenchTreeElementHasParent, WorkbenchTreeElementHasChild, WorkbenchTreeElementCanExpand, RawWorkbenchListFocusContextKey, WorkbenchTreeFindOpen, WorkbenchTreeSupportsFind } from 'vs/platform/list/browser/listService'; import { PagedList } from 'vs/base/browser/ui/list/listPaging'; import { equals, range } from 'vs/base/common/arrays'; import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; @@ -634,7 +634,7 @@ CommandsRegistry.registerCommandAlias('list.toggleFilterOnType', 'list.toggleFin KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'list.find', weight: KeybindingWeight.WorkbenchContrib, - when: RawWorkbenchListFocusContextKey, + when: ContextKeyExpr.and(RawWorkbenchListFocusContextKey, WorkbenchTreeSupportsFind), primary: KeyMod.CtrlCmd | KeyCode.KeyF, secondary: [KeyCode.F3], handler: (accessor) => { diff --git a/src/vs/workbench/contrib/preferences/browser/settingsTree.ts b/src/vs/workbench/contrib/preferences/browser/settingsTree.ts index 90a8b212b6c..2ad3516e3e9 100644 --- a/src/vs/workbench/contrib/preferences/browser/settingsTree.ts +++ b/src/vs/workbench/contrib/preferences/browser/settingsTree.ts @@ -2367,6 +2367,7 @@ export class SettingsTree extends WorkbenchObjectTree<SettingsTreeElement> { filter: instantiationService.createInstance(SettingsTreeFilter, viewState), smoothScrolling: configurationService.getValue<boolean>('workbench.list.smoothScrolling'), multipleSelectionSupport: false, + findWidgetEnabled: false }, instantiationService, contextKeyService, |