Change:
<!-- Do Not Delete This! bugreporttemplate --<!-- Please read our Rules of Conduct: --<!-- Please search existing issues to avoid creating duplicates. --<!-- Also please test using the latest insiders build to make sure your issue has not already been fixed: --<!-- Use Help Report Issue to prefill these. --- VSCode Version: 1.50.0-insider OS Version: macOS Catalina Steps to Reproduce: In the same vein as , but with selected (works with countDescending). +P "Search editor" (open the search editor) something, results appear sorted by path <!-- Launch with to check. --Does this issue occur when all extensions are disabled?: Yes /cc <3
(Experimental duplicate detection) Thanks for submitting this issue. Please also check if it is already covered by an existing one, like: <!-- score: 0.498 --<!-- potentialduplicatescomment --
Hey Jackson! Do you mind if I give this try? Any ideas for where to start?
Sure, is from a similar feature request, this is the relevant bit I'd expect that PR to support modified times by default, but I'm guessing in this region of the s are not defined: In the search view we use this utility to define them:
Great! Thanks for your help. I'll look into it and let you know how I fare.
My understanding so far is that the searchMatchComparer function essentially orders two files of the same type depending on the configuration that is chosen? However, whenever I put a breakpoint in the searchMatchComparer function, it doesn't break. How do I trigger the breakpoint in the searchMatchComparer function so I can check the values of fileStatA and B and check if the case "Modified" is actually getting reached? I thought that the above might be a good place to start but let me know if I'm off base and getting the wrong ideas. Hope that it isn't too much trouble to answer and thanks for your help in advance : )
I'd expect the breakpoint to be hit - are you able to hit other breakpoints in the build?
I found something strange. The breakpoints don't hit when I run control + shift + p. But if I run control + shift + f, they hit. Any ideas?
This is the command palette shortcut? Not clear to me what you're saying.
The bug isn't there on my system. Searching files by name isn't supposed to trigger the same search I don't think, so the modified time sort seems to be working fine.
I might be wrong, but I followed the exact same steps to reproduce the bug but it is working totally fine on my system. The files are sorted on the basis of modified time.
are you still working on this? if not I can take a look at it
I can confirm that the sorting of results in the search editor does not respect the recent setting. To verify: a search in the search editor a result in a new file . does not appear at top.
jeanp413 go ahead! I wasn't able to reproduce the bug last time, but I'll try again in a bit with Jackson's suggestions to double check.
<3

Discussion:
import { InputBoxFocusedKey } from 'vs/workbench/contrib/search/common/constants'; import { ITextQueryBuilderOptions, QueryBuilder } from 'vs/workbench/contrib/search/common/queryBuilder'; import { getOutOfWorkspaceEditorResources } from 'vs/workbench/contrib/search/common/search'; <del> import { SearchModel } from 'vs/workbench/contrib/search/common/searchModel'; </del> <ins> import { SearchModel, SearchResult } from 'vs/workbench/contrib/search/common/searchModel'; </ins> import { InSearchEditor, SearchEditorFindMatchClass, SearchEditorID } from 'vs/workbench/contrib/searchEditor/browser/constants'; import type { SearchConfiguration, SearchEditorInput } from 'vs/workbench/contrib/searchEditor/browser/searchEditorInput'; import { serializeSearchResultForEditor } from 'vs/workbench/contrib/searchEditor/browser/searchEditorSerialization'; import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; <del> import { IPatternInfo, ISearchConfigurationProperties, ITextQuery } from 'vs/workbench/services/search/common/search'; </del> <ins> import { IPatternInfo, ISearchConfigurationProperties, ITextQuery, SearchSortOrder } from 'vs/workbench/services/search/common/search'; </ins> import { searchDetailsIcon } from 'vs/workbench/contrib/search/browser/searchIcons'; <ins> import { IFileService } from 'vs/platform/files/common/files'; </ins> const RESULT_LINE_REGEX = /^(s+)(d+)(:| )(s+)(.*)$/; const FILE_LINE_REGEX = /^(S.*):$/;

@IEditorGroupsService protected editorGroupService: IEditorGroupsService, @IEditorService protected editorService: IEditorService, @IConfigurationService protected configurationService: IConfigurationService, <ins> @IFileService private readonly fileService: IFileService </ins> ) { super(SearchEditor.ID, telemetryService, instantiationService, storageService, textResourceService, themeService, editorService, editorGroupService); this.container = DOM.$('.search-editor');

this.searchResultEditor = super.getControl() as CodeEditorWidget; this.searchResultEditor.onMouseUp(e => { if (e.event.detail === 2) { <del> const behaviour = this.configurationService.getValue<ISearchConfigurationProperties>('search').searchEditor.doubleClickBehaviour; </del> <ins> const behaviour = this.searchConfig.searchEditor.doubleClickBehaviour; </ins> const position = e.target.position; if (position && behaviour !== 'selectWord') { const line = this.searchResultEditor.getModel()?.getLineContent(position.lineNumber) ?? '';

}, afterContext: config.contextLines, beforeContext: config.contextLines, <del> isSmartCase: this.configurationService.getValue<ISearchConfigurationProperties>('search').smartCase, </del> <ins> isSmartCase: this.searchConfig.smartCase, </ins> expandPatterns: true };

return; } <del> const sortOrder = this.configurationService.getValue<ISearchConfigurationProperties>('search').sortOrder; </del> <ins> const sortOrder = this.searchConfig.sortOrder; if (sortOrder === SearchSortOrder.Modified) { await this.retrieveFileStats(this.searchModel.searchResult); } </ins> const controller = ReferencesController.get(this.searchResultEditor); controller.closeWidget(false); const labelFormatter = (uri: URI): string => this.labelService.getUriLabel(uri, { relative: true });

input.setMatchRanges(results.matchRanges); } <ins> private async retrieveFileStats(searchResult: SearchResult): Promise<void> { const files = searchResult.matches().filter(f => !f.fileStat).map(f => f.resolveFileStat(this.fileService)); await Promise.all(files); } </ins> layout(dimension: DOM.Dimension) { this.dimension = dimension; this.reLayout();