diff --git a/src/vs/base/browser/ui/tree/abstractTree.ts b/src/vs/base/browser/ui/tree/abstractTree.ts index 09ce418bda9..cff0e6614d3 100644 --- a/src/vs/base/browser/ui/tree/abstractTree.ts +++ b/src/vs/base/browser/ui/tree/abstractTree.ts @@ -947,7 +947,7 @@ interface IAbstractFindControllerOptions extends IFindWidgetOptions { showNotFoundMessage?: boolean; } -interface IFindControllerOptions extends IAbstractFindControllerOptions { +export interface IFindControllerOptions extends IAbstractFindControllerOptions { defaultFindMode?: TreeFindMode; defaultFindMatchType?: TreeFindMatchType; } diff --git a/src/vs/base/browser/ui/tree/asyncDataTree.ts b/src/vs/base/browser/ui/tree/asyncDataTree.ts index dd6059051f0..f6c47bb9283 100644 --- a/src/vs/base/browser/ui/tree/asyncDataTree.ts +++ b/src/vs/base/browser/ui/tree/asyncDataTree.ts @@ -7,7 +7,7 @@ import { IDragAndDropData } from '../../dnd.js'; import { IIdentityProvider, IKeyboardNavigationLabelProvider, IListDragAndDrop, IListDragOverReaction, IListVirtualDelegate } from '../list/list.js'; import { ElementsDragAndDropData, ListViewTargetSector } from '../list/listView.js'; import { IListStyles } from '../list/listWidget.js'; -import { ComposedTreeDelegate, TreeFindMode as TreeFindMode, IAbstractTreeOptions, IAbstractTreeOptionsUpdate, TreeFindMatchType, AbstractTreePart, LabelFuzzyScore, FindFilter, FindController, ITreeFindToggleChangeEvent } from './abstractTree.js'; +import { ComposedTreeDelegate, TreeFindMode as TreeFindMode, IAbstractTreeOptions, IAbstractTreeOptionsUpdate, TreeFindMatchType, AbstractTreePart, LabelFuzzyScore, FindFilter, FindController, ITreeFindToggleChangeEvent, IFindControllerOptions } from './abstractTree.js'; import { ICompressedTreeElement, ICompressedTreeNode } from './compressedObjectTreeModel.js'; import { getVisibleState, isFilterResult } from './indexTreeModel.js'; import { CompressibleObjectTree, ICompressibleKeyboardNavigationLabelProvider, ICompressibleObjectTreeOptions, ICompressibleTreeRenderer, IObjectTreeOptions, IObjectTreeSetChildrenOptions, ObjectTree } from './objectTree.js'; @@ -629,7 +629,12 @@ export class AsyncDataTree implements IDisposable this.tree.onDidChangeCollapseState(this._onDidChangeCollapseState, this, this.disposables); if (asyncFindEnabled) { - const findOptions = { styles: options.findWidgetStyles, showNotFoundMessage: options.showNotFoundMessage }; + const findOptions: IFindControllerOptions = { + styles: options.findWidgetStyles, + showNotFoundMessage: options.showNotFoundMessage, + defaultFindMatchType: options.defaultFindMatchType, + defaultFindMode: options.defaultFindMode, + }; this.findController = this.disposables.add(new AsyncFindController(this.tree, options.findProvider!, findFilter!, this.tree.options.contextViewProvider!, findOptions)); this.focusNavigationFilter = node => this.findController!.shouldFocusWhenNavigating(node); @@ -657,8 +662,18 @@ export class AsyncDataTree implements IDisposable return new ObjectTree(user, container, objectTreeDelegate, objectTreeRenderers, objectTreeOptions); } - updateOptions(options: IAsyncDataTreeOptionsUpdate = {}): void { - this.tree.updateOptions(options); + updateOptions(optionsUpdate: IAsyncDataTreeOptionsUpdate = {}): void { + if (this.findController) { + if (optionsUpdate.defaultFindMode !== undefined) { + this.findController.mode = optionsUpdate.defaultFindMode; + } + + if (optionsUpdate.defaultFindMatchType !== undefined) { + this.findController.matchType = optionsUpdate.defaultFindMatchType; + } + } + + this.tree.updateOptions(optionsUpdate); } get options(): IAsyncDataTreeOptions { @@ -1513,10 +1528,6 @@ export class CompressibleAsyncDataTree extends As }; } - override updateOptions(options: ICompressibleAsyncDataTreeOptionsUpdate = {}): void { - this.tree.updateOptions(options); - } - override getViewState(): IAsyncDataTreeViewState { if (!this.identityProvider) { throw new TreeError(this.user, 'Can\'t get tree view state without an identity provider');