-
Notifications
You must be signed in to change notification settings - Fork 744
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
Add support for jsx syntax highlighting in .js files #968
Comments
We might be able to switch things around slightly and instead of subclassing Javascript we could detect JSX inside the Javascript lexer itself and delegate to JSX. It may take a bit of reworking the current JSX lexer. I'm not familar with JS or JSX. If someone wants to take a crack at implementation that would be awesome. Otherwise, I'll investigate in the future. |
In GitLab you can override the lexer choice based on |
I suppose we could also disambiguate fairly if we allowed this to have .js
extension, as well? Would that be ill-advised @jneen? I suppose it depends
on how easily/definitively we can disambiguate
…On Tue, Aug 7, 2018 at 9:39 PM Jeanine Adkisson ***@***.***> wrote:
In GitLab you can override the lexer choice based on .gitattributes as
well.
https://docs.gitlab.com/ee/user/project/highlighting.html
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#968 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACSKlNRTEg2I-xI7oQkDCh5r8vcPf97zks5uOk9agaJpZM4VrPhJ>
.
|
JSX isn't supported in vanilla javascript unfortunately :\ |
(I'm also not convinced of the reasoning behind not using .jsx as an extension, given the other highlighting issues it seems to be causing...) |
I've created a gitlab project to test and it worked with |
@jneen there are plenty of arguments for and against using .jsx in this thread if you're interested: airbnb/javascript#985 |
@dblessing it must be possible to disambiguate since vscode and github both disambiguate, parse and sintax highlight jsx correctly, refering to them as javascript |
Is there a marking or some special comment that indicates that it is jsx, or do these tools just use a jsx lexer for all javascript? The reason I'm hesitant to do the latter is that the jsx lexer is a bit complicated and likely slow. |
I'm not sure. I think vscode checks for imports of React on the javascript lexer to switch as it hints jsx as syntax error indicating that react should be imported |
This issue has been automatically marked as stale because it has not had any activity for more than a year. It will be closed if no additional activity occurs within the next 14 days. If you would like this issue to remain open, please reply and let us know if the issue is still reproducible. |
As noted here, using .jsx file extensions is not recommended.
Can we have JSX syntax highlighting in regular .js files?
I use gitlab at work and the syntax highlighting is terrible because of this.
The text was updated successfully, but these errors were encountered: