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:
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user