Change:
to search, then click the that expands the results. :bug: does not expand. Looking into this more, it is because the call for the node isn't working.
I've also seen the same thing with not working. Unsure if this is related, but the repro is the same, but between step 2 and 3, expand the AI results.
This seems to also happen in when in tree mode.
It could be very expensive if expand all would actually expand all tree nodes in an async data tree. It's possible to have infinite deep async trees so in those cases this method would crash. My recommendation would be to create your own implementation for this in the search view. If that does not work the way you would like it to, we could consider alternatives. I think the bulk edit pane has a similar behaviour here:

Discussion:
import { Schemas } from '../../../../base/common/network.js'; import { IEditorGroupsService } from '../../../services/editor/common/editorGroupsService.js'; import { IEditorService } from '../../../services/editor/common/editorService.js'; <ins> import { forcedExpandRecursively } from './searchActionsTopBar.js'; </ins> //#region Interfaces

if (searchView) { const viewer = searchView.getControl(); const selected = viewer.getFocus()[0]; <del> await viewer.expand(selected, true); </del> <ins> await forcedExpandRecursively(viewer, selected); </ins> } }

import * as nls from '../../../../nls.js'; import { ICommandHandler } from '../../../../platform/commands/common/commands.js'; import { ServicesAccessor } from '../../../../platform/instantiation/common/instantiation.js'; <del> import { WorkbenchListFocusContextKey } from '../../../../platform/list/browser/listService.js'; </del> <ins> import { WorkbenchCompressibleAsyncDataTree, WorkbenchListFocusContextKey } from '../../../../platform/list/browser/listService.js'; </ins> import { IViewsService } from '../../../services/views/common/viewsService.js'; import { searchClearIcon, searchCollapseAllIcon, searchExpandAllIcon, searchRefreshIcon, searchShowAsList, searchShowAsTree, searchStopIcon } from './searchIcons.js'; import * as Constants from '../common/constants.js'; import { ISearchHistoryService } from '../common/searchHistoryService.js'; <del> import { FileMatch, FolderMatch, FolderMatchNoRoot, FolderMatchWorkspaceRoot, Match, SearchResult, TextSearchResult } from './searchModel.js'; </del> <ins> import { FileMatch, FolderMatch, FolderMatchNoRoot, FolderMatchWorkspaceRoot, Match, RenderableMatch, SearchResult, TextSearchResult } from './searchModel.js'; </ins> import { VIEW_ID } from '../../../services/search/common/search.js'; import { ContextKeyExpr } from '../../../../platform/contextkey/common/contextkey.js'; import { Action2, MenuId, registerAction2 } from '../../../../platform/actions/common/actions.js';

if (searchView.shouldShowAIResults()) { if (searchView.model.hasAIResults) { <del> viewer.expandAll(); </del> <ins> await forcedExpandRecursively(viewer, undefined); </ins> } else { <del> await viewer.expand(searchView.model.searchResult.plainTextSearchResult, true); </del> <ins> await forcedExpandRecursively(viewer, searchView.model.searchResult.plainTextSearchResult); </ins> } } else { <del> viewer.expandAll(); </del> <ins> await forcedExpandRecursively(viewer, undefined); </ins> } } } <ins> /** * Recursively expand all nodes in the search results tree that are a child of `element` * If `element` is not provided, it is the root node. */ export async function forcedExpandRecursively( viewer: WorkbenchCompressibleAsyncDataTree<SearchResult, RenderableMatch, void>, element: RenderableMatch | undefined ) { if (element) { if (!viewer.hasNode(element)) { return; } await viewer.expand(element, true); } const children = viewer.getNode(element)?.children; if (children) { for (const child of children) { if (child.element instanceof SearchResult) { throw Error('SearchResult should not be a child of a RenderableMatch'); } forcedExpandRecursively(viewer, child.element); } } } </ins> function clearSearchResults(accessor: ServicesAccessor) { const viewsService = accessor.get(IViewsService); const searchView = getSearchView(viewsService);