Skip to content

Commit e9bda7a

Browse files
authored
Update list find context key (microsoft#156903)
Fix microsoft#156878. Update list support find context key name
1 parent 1259bfe commit e9bda7a

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/vs/platform/list/browser/listService.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,12 @@ export const WorkbenchListHasSelectionOrFocus = new RawContextKey<boolean>('list
120120
export const WorkbenchListDoubleSelection = new RawContextKey<boolean>('listDoubleSelection', false);
121121
export const WorkbenchListMultiSelection = new RawContextKey<boolean>('listMultiSelection', false);
122122
export const WorkbenchListSelectionNavigation = new RawContextKey<boolean>('listSelectionNavigation', false);
123+
export const WorkbenchListSupportsFind = new RawContextKey<boolean>('listSupportsFind', true);
123124
export const WorkbenchTreeElementCanCollapse = new RawContextKey<boolean>('treeElementCanCollapse', false);
124125
export const WorkbenchTreeElementHasParent = new RawContextKey<boolean>('treeElementHasParent', false);
125126
export const WorkbenchTreeElementCanExpand = new RawContextKey<boolean>('treeElementCanExpand', false);
126127
export const WorkbenchTreeElementHasChild = new RawContextKey<boolean>('treeElementHasChild', false);
127128
export const WorkbenchTreeFindOpen = new RawContextKey<boolean>('treeFindOpen', false);
128-
export const WorkbenchTreeSupportsFind = new RawContextKey<boolean>('treeSupportsFind', true);
129129
const WorkbenchListTypeNavigationModeKey = 'listTypeNavigationMode';
130130

131131
/**
@@ -1136,6 +1136,7 @@ class WorkbenchTreeInternals<TInput, T, TFilterData> {
11361136

11371137
readonly contextKeyService: IContextKeyService;
11381138
private listSupportsMultiSelect: IContextKey<boolean>;
1139+
private listSupportFindWidget: IContextKey<boolean>;
11391140
private hasSelectionOrFocus: IContextKey<boolean>;
11401141
private hasDoubleSelection: IContextKey<boolean>;
11411142
private hasMultiSelection: IContextKey<boolean>;
@@ -1144,7 +1145,6 @@ class WorkbenchTreeInternals<TInput, T, TFilterData> {
11441145
private treeElementCanExpand: IContextKey<boolean>;
11451146
private treeElementHasChild: IContextKey<boolean>;
11461147
private treeFindOpen: IContextKey<boolean>;
1147-
private treeSupportFindWidget: IContextKey<boolean>;
11481148
private _useAltAsMultipleSelectionModifier: boolean;
11491149
private disposables: IDisposable[] = [];
11501150
private styler: IDisposable | undefined;
@@ -1170,6 +1170,9 @@ class WorkbenchTreeInternals<TInput, T, TFilterData> {
11701170
const listSelectionNavigation = WorkbenchListSelectionNavigation.bindTo(this.contextKeyService);
11711171
listSelectionNavigation.set(Boolean(options.selectionNavigation));
11721172

1173+
this.listSupportFindWidget = WorkbenchListSupportsFind.bindTo(this.contextKeyService);
1174+
this.listSupportFindWidget.set(options.findWidgetEnabled ?? true);
1175+
11731176
this.hasSelectionOrFocus = WorkbenchListHasSelectionOrFocus.bindTo(this.contextKeyService);
11741177
this.hasDoubleSelection = WorkbenchListDoubleSelection.bindTo(this.contextKeyService);
11751178
this.hasMultiSelection = WorkbenchListMultiSelection.bindTo(this.contextKeyService);
@@ -1180,8 +1183,6 @@ class WorkbenchTreeInternals<TInput, T, TFilterData> {
11801183
this.treeElementHasChild = WorkbenchTreeElementHasChild.bindTo(this.contextKeyService);
11811184

11821185
this.treeFindOpen = WorkbenchTreeFindOpen.bindTo(this.contextKeyService);
1183-
this.treeSupportFindWidget = WorkbenchTreeSupportsFind.bindTo(this.contextKeyService);
1184-
this.treeSupportFindWidget.set(options.findWidgetEnabled ?? true);
11851186

11861187
this._useAltAsMultipleSelectionModifier = useAltAsMultipleSelectionModifier(configurationService);
11871188

src/vs/workbench/browser/actions/listCommands.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
77
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
88
import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
99
import { List } from 'vs/base/browser/ui/list/listWidget';
10-
import { WorkbenchListFocusContextKey, IListService, WorkbenchListSupportsMultiSelectContextKey, ListWidget, WorkbenchListHasSelectionOrFocus, getSelectionKeyboardEvent, WorkbenchListWidget, WorkbenchListSelectionNavigation, WorkbenchTreeElementCanCollapse, WorkbenchTreeElementHasParent, WorkbenchTreeElementHasChild, WorkbenchTreeElementCanExpand, RawWorkbenchListFocusContextKey, WorkbenchTreeFindOpen, WorkbenchTreeSupportsFind } from 'vs/platform/list/browser/listService';
10+
import { WorkbenchListFocusContextKey, IListService, WorkbenchListSupportsMultiSelectContextKey, ListWidget, WorkbenchListHasSelectionOrFocus, getSelectionKeyboardEvent, WorkbenchListWidget, WorkbenchListSelectionNavigation, WorkbenchTreeElementCanCollapse, WorkbenchTreeElementHasParent, WorkbenchTreeElementHasChild, WorkbenchTreeElementCanExpand, RawWorkbenchListFocusContextKey, WorkbenchTreeFindOpen, WorkbenchListSupportsFind } from 'vs/platform/list/browser/listService';
1111
import { PagedList } from 'vs/base/browser/ui/list/listPaging';
1212
import { equals, range } from 'vs/base/common/arrays';
1313
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
@@ -634,7 +634,7 @@ CommandsRegistry.registerCommandAlias('list.toggleFilterOnType', 'list.toggleFin
634634
KeybindingsRegistry.registerCommandAndKeybindingRule({
635635
id: 'list.find',
636636
weight: KeybindingWeight.WorkbenchContrib,
637-
when: ContextKeyExpr.and(RawWorkbenchListFocusContextKey, WorkbenchTreeSupportsFind),
637+
when: ContextKeyExpr.and(RawWorkbenchListFocusContextKey, WorkbenchListSupportsFind),
638638
primary: KeyMod.CtrlCmd | KeyCode.KeyF,
639639
secondary: [KeyCode.F3],
640640
handler: (accessor) => {

0 commit comments

Comments
 (0)