Skip to content

Performance: Lazy highlight search results

Administrator requested to merge tr/lazy-load-search-results into main

Created by: umpox

Actions before merging this PR:

  • Check with the search team if this is desired, particularly with @novoselrok as it might not be as necessary if we can stream the first X results (although still helps when scrolling through)

Description

Adds lazy syntax highlighting to search results.

Note There's room for more experimentation here. We could also:

  1. Do the highlighting on the client and only fetch LSIF data from the backend like we do here. Potentially faster, although building the HTML on the quick isn't particularly quick either
  2. Share the highlighting between the Blob page and the search results. If we have the highlight the entire file for a search result, then we shouldn't do it again when we then load that result in the blob. Perhaps we could share a query between these two views.

Before

https://user-images.githubusercontent.com/9516420/184338603-ecaff983-605a-477c-929e-d455aefd8f10.mp4

After

https://user-images.githubusercontent.com/9516420/184338365-6447f3f0-a4c1-4576-b701-0adc6526a3a5.mp4

Test Plan

Per the videos attached above, ensure the behavior is as expected in-app.

App preview:

Check out the client app preview documentation to learn more.

Merge request reports

Loading