Performance: Lazily syntax highlight blob views
Created by: umpox
Note For reviewer: This started pretty experimental, but I think it could be a useful performance UX win. New to this part of the code base so please let me know if I should be doing something differently!
Description
This PR adds an experimental feature that:
- Fetches and renders formatted but unhighlighted code blobs. We keep the formatting to ensure we don't have a large layout shift when the backend finally returns.
- Disables the loading spinner on the blob view. I think we can now reasonably say that almost every file (?) should be returned almost immediately, so we shouldn't need this.
Example 1: Compared against the current blob view and syntax highlighting
Noticeable on most files, much less time waiting to view code.
https://user-images.githubusercontent.com/9516420/182154393-b1e31027-16a1-412d-bd4e-11ae12a546c1.mp4
Example 2: Compared against CodeMirror and the newer syntax highlighting
Mainly noticeable on medium/large files, still valuable I think. New syntax highlighting is pretty awesome :)
https://user-images.githubusercontent.com/9516420/182156731-3c24d69b-11a9-410a-abe6-a6f87e6879c3.mp4
Test plan
Tested locally with the flag enabled and disabled