perf(addon-search): avoid redundant result array copy in tracker

Skip slicing when the caller already respects the highlight limit.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Daniel Imms
2026-05-25 17:42:17 -07:00
co-authored by Cursor
parent e4ebd082ce
commit f28bfb7142
@@ -54,7 +54,7 @@ export class SearchResultTracker extends Disposable {
* @param maxResults The maximum number of results to track.
*/
public updateResults(results: ISearchResult[], maxResults: number): void {
this._searchResults = results.slice(0, maxResults);
this._searchResults = results.length <= maxResults ? results : results.slice(0, maxResults);
}
/**