This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 250778

Summary: Add support for JSX (ReactJS)
Product: javascript Reporter: bfanger
Component: EditorAssignee: Petr Pisl <ppisl>
Status: CLOSED FIXED    
Severity: normal CC: dylanv, geertjan, midnightlightning, novikovd, phejl, simas, srt, terje7601, zimmi
Priority: P3    
Version: 8.2   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

Description bfanger 2015-02-27 20:47:21 UTC
JSX is a mixture between Javascript and XML and is used the write ReactJS webapps.

I'd like to use Netbeans javascript refactor and syntax-highlighting features for jsx files, but setting up netbeans to read a *.jsx file as javascript obviously generates syntax errors.

Resources:
http://facebook.github.io/jsx/
http://facebook.github.io/react/docs/jsx-in-depth.html
https://blogs.oracle.com/geertjan/entry/react_js_and_netbeans_ide
Comment 1 dylanv 2015-03-07 13:41:42 UTC
Yeah even if we get autocomplete for JSX later (I personally hate JSX and don't use it, but I have colleagues who do), we should at least be able support the grammar for Lexing the file so that we don't get errors.
Comment 2 mediacept 2015-07-21 08:43:10 UTC
+1 for React *.jsx support (refactor and syntax-highlighting) in next Netbeans versions.
Thank you.
Comment 3 Ser_Vant 2015-07-23 11:44:43 UTC
I use NB more than 8 years. But now I need JSX. And I must change my IDE to another.
Comment 4 devilcius 2015-08-08 10:35:45 UTC
+1.
jsx files support and syntax highlighting for, in my opinion, the best html editor.
Comment 5 midnightlightning 2015-08-20 15:33:47 UTC
*** Bug 250288 has been marked as a duplicate of this bug. ***
Comment 6 simas 2015-09-19 11:54:04 UTC
+1
Comment 7 xianyunjushi 2015-09-29 18:08:27 UTC
Please add this support to 8.1 so we can start using it next month. Right now, InteliJ, WebStorm, Sublime, Atom all have support for ReactJS.
With React Native released, react become very hot, many developers are learning/using React now. If we don't support this, many of them will go for other IDEs.

We love NetBeans, so like to keep using NetBeans.

Thanks!
Comment 8 luciafigueroa 2015-09-29 18:10:45 UTC
(In reply to xianyunjushi from comment #7)
> Please add this support to 8.1 so we can start using it next month. Right
> now, InteliJ, WebStorm, Sublime, Atom all have support for ReactJS.
> With React Native released, react become very hot, many developers are
> learning/using React now. If we don't support this, many of them will go for
> other IDEs.
> 
> We love NetBeans, so like to keep using NetBeans.
> 
> Thanks!

Well said Xian!
Comment 9 ravshansbox 2015-10-02 11:13:53 UTC
+1
Comment 10 mediacept 2015-10-02 17:38:31 UTC
(In reply to xianyunjushi from comment #7)
> Please add this support to 8.1 so we can start using it next month. Right
> now, InteliJ, WebStorm, Sublime, Atom all have support for ReactJS.
> With React Native released, react become very hot, many developers are
> learning/using React now. If we don't support this, many of them will go for
> other IDEs.
> 
> We love NetBeans, so like to keep using NetBeans.
> 
> Thanks!

YES YES YES xianyunjushi!
Comment 12 xianyunjushi 2015-10-07 16:04:14 UTC
Dear Sir/Madam,

I just learned today, while search for good, free IDE supporting ReactJS/JSX, Microsoft Visual Studio 2015 Community (free) supports ReactJS and JSX now, and they are planing to have better support of ReactJS and JSX in the coming VS 2015 Update 1:
https://adtmag.com/blogs/dev-watch/2015/08/react-visual-studio.aspx

Please let NetBeans 8.1 support ReactJS and JSX ASAP.

Thanks!
Comment 13 SystemicPlural 2015-10-15 14:50:46 UTC
8.1 Release candidate is out and it seems to resolve this problem.
Comment 14 mediacept 2015-10-25 13:04:17 UTC
@SystemicPlural
Not true. Not yet resolved, even in RC2.
Comment 15 justblackbird 2015-11-06 19:08:03 UTC
+1 here. I believe it could help Netbeans to prevent users who work with React to change their IDE.
Comment 16 AlmightyR 2015-11-11 20:52:57 UTC
I also vote in support for React and .jsx support in NetBeans.

Initially, recognition of the file and basic support is enough, but later, if possible, it would be nice to have more advanced features like syntax highlight, error-checks, completion, and all the other good stuff.
Comment 17 compua 2015-11-18 10:43:26 UTC
Please implement the support for JSX. Love NetBeans, but now have to work with React, and need to switch to other IDEs. Please do not make me do it).
Comment 18 abbr 2015-12-09 22:34:56 UTC
I switched to NB from Eclipse and Brackets not long ago after finding it has overall better support for Node and JS. But lacking jsx awareness prompted me to switch IDE again, at least for React projects.
Comment 19 donhenton 2015-12-16 15:24:10 UTC
please add support for jsx, +1 !!!!
Comment 20 novikovd 2015-12-26 21:39:20 UTC
+1
Comment 21 mehiel 2016-01-05 21:07:48 UTC
Another +1 here! almost as important as proper ES6 support.
Comment 22 gianluca.ferrantelli 2016-01-28 09:13:37 UTC
+1 !!!
Comment 23 jbcoder 2016-03-18 17:37:55 UTC
+1 here as well


Has there been update to this? This bug was registered last February and there still seems to be no status change despite the growth of React.
Comment 24 barulheira 2016-03-18 17:41:44 UTC
February LAST YEAR, you mean.
Comment 25 badpenguin 2016-03-25 11:24:14 UTC
+1
Comment 26 slavb18 2016-03-29 10:50:05 UTC
+1
Comment 27 ahmedprohic 2016-03-29 10:53:26 UTC
Goodbye NetBeans. We had a lot of fun together.
Comment 28 Christian Lenz 2016-03-29 11:17:41 UTC
Please do not only add a +1 as a comment, please vote for them that it will be higher prioritized.
Comment 29 jbcoder 2016-04-04 21:15:00 UTC
Maybe they should change their voting system to make it a bit clearer. I've been a part of the community off and on for years and never knew that they even had voting.
Comment 30 jeromeb 2016-04-18 20:28:16 UTC
+1
Comment 31 pachat 2016-05-25 16:42:45 UTC
I need ReactJS to come back to NetBeans
Comment 32 fleka 2016-06-20 11:42:40 UTC
+1
Comment 33 Rahul.khandelwal 2016-07-01 11:14:24 UTC
With 62 votes, it should be priority one enhancement.
This is a great feature to have as react and angular are the future of client side web development.
Comment 34 anatolse 2016-07-13 13:41:08 UTC
I need ReactJS to come back to NetBeans
Comment 35 Petr Pisl 2016-07-13 14:14:23 UTC
(In reply to anatolse from comment #34)
> I need ReactJS to come back to NetBeans

What do you mean "come back"? The support was not a part of NB yet :(. 

Anyway I and Petr Hejl we are  hardly working on the basic support, now we have at least on the parser and coloring lexer level something. A few seconds ago Petr merged our branch to the trunk (web-main http://hg.netbeans.org/web-main/rev/0f16e4ffb9b6), so if everything go in the right way, the result can be in daily build tomorrow or the next day.
Comment 36 idclaar 2016-07-13 14:18:45 UTC
Thank you (both) Petr for your efforts on this.  I can't tell you enough how greatly appreciated it is!
Comment 37 novikovd 2016-07-13 14:21:00 UTC
omg guys you are the best!
Comment 38 pachat 2016-07-13 14:26:10 UTC
By "come back", I mean "Use NB again" (which I currently do not use because of lack of ReactJS)

As I like the other features but dramatically need ReadtJS, I'm very pleased to hear that you are working on, and hope to use NB again as soon as ReactJS is there.

Thanx
Comment 39 devilcius 2016-07-13 14:27:41 UTC
Great news. Thanks, Petr H. and Petr P.
Comment 40 everflux 2016-07-14 19:14:41 UTC
Thanks a lot for working on this!

If I understand the commit correctly, the JSX support is added to JsColoringScanner.flex directly.
Would it make sense to separate it into a plugin instead of having it in the JavaScript core support?
If it becomes an integral part, it might be hard to remove or maintain later, for whatever reason like if JSX is abondoned, or a different version JSX2 comes out or ECMA 7/8 contradicts in some way.

(In addition a separate plugin as example would be helpful as a template for people wantint to contribute other template languages like Angular 2...)
Comment 41 Petr Hejl 2016-07-14 19:29:01 UTC
(In reply to everflux from comment #40)
> Thanks a lot for working on this!
> 
> If I understand the commit correctly, the JSX support is added to
> JsColoringScanner.flex directly.
No not really. The most important change is hidden in libs.nashorn/external/binaries-list. There is bunch of changes in the parser (JSX and ECMA7).

> Would it make sense to separate it into a plugin instead of having it in the
> JavaScript core support?
That would definitely make sense, but unfortunatelly not for 8.2.

> If it becomes an integral part, it might be hard to remove or maintain
> later, for whatever reason like if JSX is abondoned, or a different version
> JSX2 comes out or ECMA 7/8 contradicts in some way.
I agree. On the other hand unless the grammar entry point will collide it could stay there anyway.

> 
> (In addition a separate plugin as example would be helpful as a template for
> people wantint to contribute other template languages like Angular 2...)
Well the above reasons are enough to possibly separate it in the future. However my experience says the "template" approach usually does not work and one have to do lot of different things for different frameworks.
Comment 42 Christian Lenz 2016-07-25 11:31:59 UTC
I saw that the jsx support is now a part of NB nightly and will come in NB 8.2. Very nice work but only if you have js files and not jsx files, right? Should I map the jsx files to the js mimetype and eveything will be ok?
Comment 43 Petr Pisl 2016-07-26 12:30:41 UTC
(In reply to ChrisLE from comment #42)
> I saw that the jsx support is now a part of NB nightly and will come in NB
> 8.2. Very nice work but only if you have js files and not jsx files, right?
> Should I map the jsx files to the js mimetype and eveything will be ok?

Yes, it should be enough. I added today the registration of javascript mimetype for jsx files and also add new jsx template to the new file wizard in Other catogory. 

http://hg.netbeans.org/web-main/rev/a632c778b03c
Comment 44 pachat 2016-08-03 10:59:47 UTC
Hi,

Thanks for JSX integration.

So, with the nigthly build, I created a small project and added an Other/JSX File 

but I get an error "Unexpected token <"
just as if the .jsx is not interpreted.

Sources:

index.html
----------
<!DOCTYPE html>
<html>
    <head>
        <title>TODO supply a title</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="shortcut icon" href="">
        <script src="https://fb.me/react-15.0.1.js"></script>
        <script src="https://fb.me/react-dom-15.0.1.js"></script>  
        <script src="TestHTML5ApplicationReactjs.jsx" type="text/javascript"></script>
    </head>
    <body>
        <div>TODO write content</div>
    </body>
</html>


TestHTML5ApplicationReactjs.jsx (this is the default)
-------------------------------
var Hello = Rreact.createClass({
    render: function () {
        return (
<div></div>
                );
    }
});
Comment 45 Petr Pisl 2016-08-03 13:56:48 UTC
(In reply to pachat from comment #44)
> Hi,
> 
> Thanks for JSX integration.
> 
> So, with the nigthly build, I created a small project and added an Other/JSX
> File 
> 
> but I get an error "Unexpected token <"
> just as if the .jsx is not interpreted.
>  ....

Could you please create new issue for it and add information about the build number or attach please your message log? And a screenshot? It's strange it should work. Thanks
Comment 46 Petr Pisl 2016-10-10 06:54:01 UTC
Basic React support is a part of NetBeans 8.2. At least NB are able to parse react code, provide syntax coloring and offer code completion.
Comment 47 complier 2016-12-27 14:52:49 UTC
(In reply to Petr Pisl from comment #46)
> Basic React support is a part of NetBeans 8.2. At least NB are able to parse
> react code, provide syntax coloring and offer code completion.

Wow, this is awesome! I haven't yet checked it out in 8.2, but just wanted to express my appreciation for your work. Thanks!
Comment 48 Christian Lenz 2020-07-05 10:50:51 UTC
Please add bugs and feature requests at the new Apache NetBeans JIRA board: https://issues.apache.org/jira/projects/NETBEANS