-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Move .jsx
to JavaScript and remove JSX section and babel-sublime submodule
#5133
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Alhadis
approved these changes
Jan 9, 2021
thorn0
added a commit
to prettier/prettier
that referenced
this pull request
Feb 22, 2021
thorn0
added a commit
to prettier/prettier
that referenced
this pull request
Feb 22, 2021
simison
added a commit
to Trustroots/trustroots
that referenced
this pull request
Jun 9, 2021
Github has removed special JSX highlighting in Linguist, the library Github uses for syntax highlighting. It's now merged into JS highlighter. Hence we can let JS files be syntax highlighted as JS. Reference github-linguist/linguist#5133
simison
added a commit
to Trustroots/trustroots
that referenced
this pull request
Jun 9, 2021
Github has removed special JSX highlighting in Linguist, the library Github uses for syntax highlighting. It's now merged into JS highlighter. Hence we can let JS files be syntax highlighted as JS. Reference github-linguist/linguist#5133
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Whilst looking into #4835 I remembered that GitHub no longer uses the JavaScript grammar supplied with Linguist to highlight JavaScript files and instead uses the treesitter grammar at https://github.com/tree-sitter/tree-sitter-javascript . That grammar already has support for React/JSX and from the little experiment in https://gist.github.com/lildude/a67721aeaef649bbd3f8a38101d99798 it does a good job of highlighting the React/JSX fragments and doesn't stumble over the problem #4835 details.
To be clear,
sample.js
is using the treesitter grammar, whilst the identicalsample.jsx
is using the really old https://github.com/github-linguist/babel-sublime grammar.This PR addresses the highlighting issue by passing responsibility on to the treesitter grammar as it does a much better job of it.
We can't remove the JavaScript grammar from Linguist as it is used by other languages which aren't covered by the treesitter grammar.
Checklist:
I am changing the source of a syntax highlighting grammar
I've not used lightshow URLs here as lightshow doesn't support treesitter grammars.