-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Replace JSX grammar #4223
Replace JSX grammar #4223
Conversation
I've taken a quick look at the difference in grammars and the babel/babel-sublime grammar produces quite different syntax highlighting for the simple example mentioned in #3775 (comment): Interestingly, the current grammar doesn't show the problem either, but does render it quite differently: The first example of those I reference in #3775 (comment) fails quite horribly with the babel/babel-sublime: ... vs our current grammar: |
@lildude - @kivikakk mentioned the same highlighting issue in #4168, and it looks like it's coming from Lightshow. I'll wait for her go to update the original post with links to Lightshow. |
@pchaigno it certainly looks better, but still noticeably different: Not sure if this is a grammar or Lightshow difference though and if it's significantly different that peeps will notice. |
It's a grammar difference. If this grammar is anything like the obj.methodName( arg ); /*
^^^^^^^^^^ - entity.name.function.js (Current)
- variable.function.js (Babel grammar)
*/ Barring visual and aesthetic differences, the current scope-name ( |
Yep, I've seen the missing colors for HTML tags but I thought it was worth it since it fixes the previous bugs? Maybe we can report the discrepancies upstream if they're not already. |
I doubt upstream will be interested in accepting changes, since that's imposing the same unexpected (and apparently arbitrary) colour changes on users of the Remember, these scopes dictate what users have to put in their stylesheets and preference files to tweak the colour choices... |
@pchaigno It should be safe to perform a simple search-and-replace for the following patterns:
I believe including |
I was referring to the lack of HTML highlighting rather than scope names 😜
Hm, is that something we could upstream? |
Hold on, I just noticed there are spaces inside some of the scope names. Specifically, the ones affecting the HTML highlighting. Is that legal in XML TextMate grammars? Because it's been known to screw with selector matching in Atom, so I wonder if it might be having an adverse effect on Lightshow too... :\
Nope. We're performing a mass change of dozens of scope names, which goes back to my previous point. 😉 |
Looks like they're trying to define two scope names (separated by a white space) for the matched tokens... I'm surprised that even works with Sublime Text.
Right, my bad; I read a bit quickly. |
Any updates on this? I'm happy to help getting this merged. |
27d282a
to
70ff9dd
Compare
I've updated the modified version of the babel-sublime grammar hosted at github-linguist/babel-sublime to change scope names as per @Alhadis' suggestions and to fix the double scope names. Here is the result: It's not perfect because we'll have to update the scope names if the grammar is updated, but at least it fixes #3775. |
70ff9dd
to
0e66c53
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work. Thanks. 🙇♂️
Disclaimer; I haven't studied the details of this PR but I see that it was merged about a month ago and I'm still seeing busted display of JSX |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
That's probably because there hasn't been a Linguist release made since this PR was merged so you're still looking at the old behaviour. I aim to make a new release approximately monthly and today would make it exactly a month since the last release 😁 I'll try find time in the next week. |
As a follow up to the last comment, we're still seeing the same syntax highlighting problems on whatsdeployed PRs. This PR is extremely hard to review since most of the lines are covered in red backgrounds. We've seen this problem pretty continuously over the last few months. I think it is a regression based on this change, and that nothing has happened in the last few months. |
This pull request changes the JSX grammar to use https://github.com/babel/babel-sublime as discussed in #3779.
Description
Our current JSX grammar is locked to an old version because of a bug in the upstream grammar. With 632 commits behind the upstream to date, we're sure to miss important fixes and updates. Keeping the fork up-to-date is difficult because we have to watch out for PCRE incompatibilities in regular expressions.
This pull request changes the JSX grammar to use babel/babel-sublime. As discussed in #3779, the only issue is we have to change the scope to avoid a conflict with JavaScript.
@lildude I'm guessing Lightshow is still blocked by the security review... Any chance you could check on your side if the grammar applies correctly and if it fixes #3775?Fixes #3775 (cf. example 1, example 2, example 3, and example 4).