-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jison/Jisonlex files no longer highlighted correctly on GitHub #4649
Comments
#4595 didn't touch Jison highlighting, so the problem likely stems from the author's embedding of the In either case, this is an upstream issue that should be filed at the appropriate repository, not here. |
Thanks for the swift reply! The repository is https://github.com/cdibbs/language-jison, but a pretty big hunk of it is from me. So, while I can file an issue there, I’m almost certainly going to be the one to have to fix it anyway. I’ll also understand if this issue must be closed if it’s determined that this simply can’t be an issue with Linguist. I’m happy to be wrong about this, but as far as I can tell, |
I doubt it. I noticed the grammar is using injections; keep in mind they're not handled 100% consistently by GitHub's highlighter (the Also, could you be a bit more specific about which parts in particular are incorrectly highlighted? |
I was under the impression that the The part of a Jison file that’s incorrectly highlighted is everything after the first section break denoted by And here’s the same thing on Lightshow: |
Okay, so this is certainly an issue on GitHub's end. There's no reason that should be working in Lightshow and not on GitHub's side. I also noticed ordinary Lex files aren't receiving syntax highlighting at all, indicating that something very wrong is happening with Lightshow... /cc @lildude |
Whooops. I've clearly forgotten to update Lightshow 😊. I'll add it to my TODO list. |
There's still the matter of the highlighting discrepancies; in particular, the missing Lex highlighting added in the last release... |
🤔 the language is getting selected correctly so something's gone awry with picking up the grammar itself. |
I've taken a look into this as this appears to only affect languages or grammars added in v7.6.0. Work is underway to improved the syntax highlighting service used by GitHub and I suspect it has missed the v7.6.0 update. I've opened an issue to bring this to the attention of the team responsible for the improvements. I'll update when I know more or when things are working as expected again. |
Re:
... this ...
... was indeed the case. The original issue is however unrelated, that's still a grammar issue. I'll try update Lightshow in the next few days. |
I've hit a road block with updating Lightshow that is going to require some dedicated time to resolve. As this isn't related to this issue, I'm going to close this issue more. |
I understand that closing this issue is entirely up to Linguist, but I’m not sure that this is a grammar issue, and if it is a grammar issue I’m not sure how to determine what the issue is. I first noticed this issue after GitHub started using Linguist v7.6.0, around the end of Aug 2019. Jison files were definitely highlighted correctly on GitHub before then. Some of my pull requests to Jison grammars were about improving highlighting on GitHub, for example cdibbs/language-jison#8 (merged in May 2017), and it wouldn’t have made sense to make improvements to syntax highlighting on GitHub if that wasn’t working at all. One possibility mentioned in a comment on this issue is the presence of a pattern="include:\\s*[\"']source\\.\\w+"
base_URL=https://raw.githubusercontent.com/cdibbs/language-jison/v2.12.0/grammars
file=jison.cson
curl --remote-name --show-error --silent $base_URL/$file
egrep $pattern $file shows 12
Then running: file=jisonlex.cson
curl --remote-name --show-error --silent https://raw.githubusercontent.com/cdibbs/language-jison/v2.12.0/grammars/$file
egrep $pattern $file shows 15
There are no It’s probably also worth noting that syntax highlighting seems to work fine in Atom when both language-grammars and language-jison are installed: Again, I completely understand that it’s up to Linguist to determine whether this is a Linguist issue, but I’d be grateful for any guidance on where to look for what’s breaking syntax highlighting of Jison grammars on GitHub. |
🤔 I thought this was resolved already. You raise some interesting points and I'm starting to wonder if this is due to a change around the new syntax highlighting service (it provides its own Javascript grammar) or a change to the I'll reopen this and see if I can find some time to dig into this. |
I knew Tree Sitter was going to cause trouble sooner or later... 😜 |
Edit: Whoops. I was using the wrong grammar. 🤦 . 🔥 my previous update. Sidenote: I'm closer to updating Lightshow too as fresh eyes have cleared the road block I initially encountered. |
Lightshow has now been updated to Linguist v7.9.0 and it shows proper syntax highlighting for Jison. I'll look into where this is getting messed up some time this week or early next. |
Awesome, thank you for looking into this! |
This looks like a bug in GitHub's TextMate grammar engine. Lightshow uses an older version than GitHub.com, but there haven't been too many changes. |
Ok, after a bit more bisecting, I have determined that the highlighting change was caused by this code change: textmate/textmate#1437. GitHub maintains a private fork of the TextMate highlighting engine, but that ☝️ PR backports a fix that we made into TextMate upstream. The problem is explained in more detail in that PR, but the TLDR is that the jison or jisonlex grammar contains one or more invalid rules that have a Previously, a rule like that would work, but it would cause the syntax highlighter to go into a performance death spiral. Now, the Here are two examples of the problem in I opened this issue on the upstream Jison grammar repo: cdibbs/language-jison#21. |
I've now updated Lightshow to use the same version as GitHub.com and confirmed it shows the issue with the original grammar too now. The update coming in cdibbs/language-jison#22 now renders correctly too: new grammar |
Preliminary Steps
Please confirm you have...
Problem Description
Jison/Jisonlex highlighting seems to be incorrect on GitHub. Here’s an example on GitHub:
https://github.com/cdibbs/language-jison/blob/master/spec/sample.jison
And here’s the same file on Lightshow:
https://github-lightshow.herokuapp.com/?utf8=✓&scope=source.jison&grammar_format=auto&code_source=from-url&code_url=https%3A%2F%2Fraw.githubusercontent.com%2Fcdibbs%2Flanguage-jison%2Fmaster%2Fspec%2Fsample.jison
Lightshow appears to be running Linguist v7.3.1. If GitHub is running Linguist v7.6.0 or later, this may be related to PR #4595.
The text was updated successfully, but these errors were encountered: