Poor UX on syntax highlighting timeouts
Created by: varungandhi-src
Currently, when a file takes long to highlight, we surface an error in the UI. (example)
http://syntect-server:9238: HSS worker timeout while serving request
This is not great.
- It is leaking a bunch of implementation details to users.
- There is a very reasonable fallback behavior which is not implemented: show the unhighlighted file.
For example, a customer ran into this earlier with Sourcegraph 3.38.
As we move off syntect to tree-sitter for more languages, this is less likely to be an issue, as tree-sitter is faster than syntect. However, it won't resolve the issue entirely, because there will always be some files which just take too long to highlight, for one of two reasons: (1) they are quite large and/or (2) they only have a syntect grammar, and no tree-sitter grammar.
So I think we should fallback to showing the unhighlighted file if the highlighting takes too long.
For reference, GitHub outright refuses to show very large files in the UI, but it supports a "raw" view. I'm not a fan of that approach, because it degrades the user experience in a dramatic way. For example, in a raw view, it is not possible to view the blame history for a file.