chromium-codereview icon indicating copy to clipboard operation
chromium-codereview copied to clipboard

Multiline string syntax highlighting broken

Open aarongable opened this issue 11 years ago • 3 comments

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.

screenshot from 2014-11-05 10 43 09

screenshot from 2014-11-05 10 39 44

aarongable avatar Nov 05 '14 18:11 aarongable

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.

esprehn avatar Nov 15 '14 01:11 esprehn

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.

aarongable avatar Nov 15 '14 18:11 aarongable

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.

esprehn avatar Nov 21 '14 09:11 esprehn