src/vs/workbench/services/preferences/common/preferencesModels.ts/AbstractSettingsModel/filterSettings
class AbstractSettingsModel:	filterSettings(filter: string, groupFilter: IGroupFilter, settingMatcher: ISettingMatcher): ISettingMatch[] {
		const allGroups = this.filterGroups;

		const filterMatches: ISettingMatch[] = [];
		for (const group of allGroups) {
			const groupMatched = groupFilter(group);
			for (const section of group.sections) {
				for (const setting of section.settings) {
					const settingMatchResult = settingMatcher(setting, group);

					if (groupMatched || settingMatchResult) {
						filterMatches.push({
							setting,
							matches: settingMatchResult && settingMatchResult.matches,
							matchType: settingMatchResult?.matchType ?? SettingMatchType.None,
							score: settingMatchResult?.score ?? 0
						});
					}
				}
			}
		}

		filterMatches.sort((a, b) => {
			if (a.matchType !== b.matchType) {
				// Sort by match type if the match types are not the same.
				// The priority of the match type is given by the SettingMatchType enum.
				return b.matchType - a.matchType;
			} else {
				// The match types are the same.
				if (a.setting.extensionInfo && b.setting.extensionInfo
					&& a.setting.extensionInfo.id === b.setting.extensionInfo.id) {
					// These settings belong to the same extension.
					if (a.setting.categoryLabel !== b.setting.categoryLabel
						&& (a.setting.categoryOrder !== undefined || b.setting.categoryOrder !== undefined)
						&& a.setting.categoryOrder !== b.setting.categoryOrder) {
						// These two settings don't belong to the same category and have different category orders.
						return this.compareTwoNullableNumbers(a.setting.categoryOrder, b.setting.categoryOrder);
					} else if (a.setting.categoryLabel === b.setting.categoryLabel
						&& (a.setting.order !== undefined || b.setting.order !== undefined)
						&& a.setting.order !== b.setting.order) {
						// These two settings belong to the same category, but have different orders.
						return this.compareTwoNullableNumbers(a.setting.order, b.setting.order);
					}
				}
				// In the worst case, go back to lexicographical order.
				return b.score - a.score;
			}
		});
		return filterMatches;
	}