Open aarongable opened 9 years ago
This is really hard to fix because the syntax highlighting is done on the client, and we often don't have the context to know what state to start highlighting in. Thankfully this is pretty rare.
It's not rare in Python at all, and a significant portion of codereview on Rietveld is in Python. I hit this in what feels like over half of my reviews.
Can the client-side syntax highlighting be re-run when context is loaded? That would resolve the majority of the cases.
Yeah I can resyntax highlight when context is loaded. Note that another way to fix this would be to expose the base files from the server, or the hash/rev of the base file, in an API so I can run the highlighter to get the right mode. I'd really prefer that, right now context expansion is a huge hack.
See screenshots.
In the first screenshot, the beginning of the multiline string is not in the diff (although it is in the context snippet), but the end it. This appears to result in the actual string not being highlighted (it is black), but the next piece of context (a class declaration) being colored green like a string.
In the second screenshot, context has been shown. The newly revealed context is correctly highlighted, but it didn't fix the incorrect highlighting of the original diff.