Closed Bug 1159730 Opened 9 years ago Closed 8 years ago

Javascript template string (with backquotes/ticks) aren't syntax highlighted correctly in mozreview diffs

Categories

(MozReview Graveyard :: General, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: pbro, Assigned: gps)

Details

Attachments

(2 files)

If a file diff on mozreview contains a javascript template string:

let str = `this is a template string with an ${expression}`;

then the syntax highlighting of that string is wrong, and the rest of the file is incorrectly highlighted too.

`...` strings should be at least treated like "..." strings. Bonus points if the ${...} get highlighted too.
Syntax highlighting is done via Pygments. File a bug against Pygments to support ES6 syntax and it will eventually get deployed.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → WONTFIX
Although it's a bug from the upstream project, it is a bug which should be fixed. I think that means it shouldn't be marked as WONTFIX. We can probably just leave it open until the upstream fixes it and we start using the fixed version.

(BTW, I cannot add the url in comment 2 to See Also field. That looks like a bug we should fix in Bugzilla...)
Status: RESOLVED → REOPENED
Resolution: WONTFIX → ---
Ran into this today when backticks were surrounded with red and mismatched quotes inside template strings caused mis-highlighting of the entire file.

Looks like the pygments issue has been fixed:

https://bitbucket.org/birkenfeld/pygments-main/commits/3ecc5b1c8c30

How complicated is this to deploy now?
We deploy a custom Pygments distribution from https://hg.mozilla.org/users/gszorc_mozilla.com/pygments/ because Pygments historically Pygments releases are seldom.

I see they *finally* released a new major version recently. So we can likely push that to my user repo and update the provisioning code to reference the new SHA-1. We may want to spot check things on the dev server to verify the new version didn't break any APIs. I have no clue what Pygments' API compat story is...
Status: REOPENED → NEW
Priority: -- → P2
This will upgrade Pygments on Mercurial and MozReview to 2.1.1.
Previously we were running 2.0.1 with a cherry-picked patch to
support .jsm detection as JavaScript.

A quick glance at the diff between the packages doesn't seem to reveal
any significant API changes. So this will hopefully be a drop-in
replacement.

Review commit: https://reviewboard.mozilla.org/r/35699/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/35699/
Attachment #8721541 - Flags: review?(smacleod)
Product: Developer Services → MozReview
Comment on attachment 8721541 [details]
MozReview Request: ansible: upgrade to Pygments 2.1.1 (bug 1159730); r?smacleod

https://reviewboard.mozilla.org/r/35699/#review32491
Attachment #8721541 - Flags: review?(smacleod) → review+
Status: NEW → RESOLVED
Closed: 9 years ago8 years ago
Resolution: --- → FIXED
Assignee: nobody → gps
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: