fix Settings editor search result count (#178842)

fix search result count
This commit is contained in:
Raymond Zhao 2023-03-31 13:01:12 -07:00 committed by GitHub
parent b34c6339b5
commit 1859288ca7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View file

@ -1591,7 +1591,7 @@ export class SettingsEditor2 extends EditorPane {
}
if (this.tocTreeModel && this.tocTreeModel.settingsTreeRoot) {
const count = this.tocTreeModel.settingsTreeRoot.count;
const count = this.searchResultModel.getUniqueResultsCount();
let resultString: string;
switch (count) {
case 0: resultString = localize('noResults', "No Settings Found"); break;

View file

@ -853,6 +853,13 @@ export class SearchResultModel extends SettingsTreeModel {
return this.rawSearchResults || [];
}
getUniqueResultsCount(): number {
const uniqueResults = this.getUniqueResults();
const localResultsCount = uniqueResults[0]?.filterMatches.length ?? 0;
const remoteResultsCount = uniqueResults[1]?.filterMatches.length ?? 0;
return localResultsCount + remoteResultsCount;
}
setResult(order: SearchResultIdx, result: ISearchResult | null): void {
this.cachedUniqueSearchResults = null;
this.newExtensionSearchResults = null;