src/vs/workbench/contrib/search/browser/searchView.ts/SearchView/createFolderIterator
class SearchView:	private createFolderIterator(folderMatch: FolderMatch, collapseResults: ISearchConfigurationProperties['collapseResults'], childFolderIncompressible: boolean): Iterable<ICompressedTreeElement<RenderableMatch>> {
		const sortOrder = this.searchConfig.sortOrder;

		const matchArray = this.isTreeLayoutViewVisible ? folderMatch.matches() : folderMatch.allDownstreamFileMatches();
		const matches = matchArray.sort((a, b) => searchMatchComparer(a, b, sortOrder));

		return Iterable.map(matches, match => {
			let children;
			if (match instanceof FileMatch) {
				children = this.createFileIterator(match);
			} else {
				children = this.createFolderIterator(match, collapseResults, false);
			}
			let nodeExists = true;
			try { this.tree.getNode(match); } catch (e) { nodeExists = false; }

			const collapsed = nodeExists ? undefined :
				(collapseResults === 'alwaysCollapse' || (match.count() > 10 && collapseResults !== 'alwaysExpand'));

			return <ICompressedTreeElement<RenderableMatch>>{ element: match, children, collapsed, incompressible: (match instanceof FileMatch) ? true : childFolderIncompressible };
		});
	}