src/vs/base/common/arrays.ts/filterSortedByKey
export function filterSortedByKey<T>(data: readonly T[], keySelector: (value: T) => number, startKey: number, endKey = startKey): T[] | null {
	const startIdx = findFirstInSorted(data, x => startKey <= keySelector(x));
	const endIdx = findFirstInSorted(data, x => endKey < keySelector(x));
	if (startIdx === endIdx) {
		return null;
	}
	return data.slice(startIdx, endIdx);
}