Skip to content

blob: correct handling of syntax highlighting timeouts

Administrator requested to merge sg/blob-highlight-aborting into master

Created by: slimsag

A regression (which apparently must've occurred awfully long ago, like around 8mo ago) means that today when syntax highlighting takes too long (which can happen for multiple reasons: due to very large files, bugs in the language grammar, or bugs in syntect itself) we are incorrectly just displaying the message and action:

Syntax-highlighting this file took too long. [Try again]

Despite the fact that the server returned an unhighlighted version of the file, we're just discarding it instead of presenting it to the user as this was originally designed / intended to work.

What this means in practice is that today Sourcegraph is very unusable on large files because as soon as you view them you get the above error and have to hit Try again and wait a very long time.

Instead, we now once again properly show the above error and action (for users who are willing to wait longer for syntax highlighting on these files) AND the actual plaintext version of the file.

How it looks:

image

Fixes #4267

See also #4364 which adds something that will allow us to e2e test this in the future.

Test plan: Manually tested using #4364, in the future we will e2e test it.

Merge request reports

Loading