-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Syntax highlighting for babel (React) #12208
Comments
This requires a CodeMirror update (which is tracking at #12177) that contains proper syntax highlighting for Otherwise 👍 |
Hi. What's the progress on it? According to the linked thread, the CodeMirror update was merged with master over a month ago. However, I cloned the master and it's still not highlighting babel syntax... |
I am a bit unclear as to what "highlighting for babel" means. But we merged JSX syntax highlighting today. |
Well when I'm using react I usually use script type "text/babel" although "text/jsx" is fine too. However, I just cloned the master right before updating this thread and JSX is not highlighting either. I'm also not sure whether to open an issue about multibrowser errors, since a search shows tons of open issues with that from quite a while ago. All I could add is that it works with the getting started project and nothing else. |
I'll try to look into it over the next few days if I can. Will keep you posted. |
Thanks! For reference, I cloned the master repo just right before commenting here. As for multibrowser...I don't want to derail this thread, but it also doesn't seem worth opening a new issue since everyone seems to have given up on it working correctly. Is that perception accurate? I already have multibrowser set to my default so it works with things like Sublime Text, it's just that Brackets defaults to chrome for Live Preview. So at the moment I can either choose an editor that allows me to test in multiple browsers or one that allows live previewing. |
From what I could glean from #12422, JSX and Babel highlighting seems to require some preference changes in the current master, but I don't see any preferences that correspond to that. Then the branch in that request updated them in two attributes files so you can just specify them using |
Hi @doralang can you share a small snippet of code so I can reproduce the issue? <script type="text/babel">
ReactDOM.render(
<h1>Hello, world!</h1>,
document.getElementById('example')
);
</script> |
I have it exactly like that. To be clear, the syntax highlighting should be the sam as with "text/javascript" not as it appears in your snippet above right? Also, when was this feature merged with the master? I see issue thread requests with people saying it's working at various points and then someone else saying they need to update something so it's rather confusing. One person says it was in the master two days ago, one earlier today, etc. If I were to clone the master right now, shift+click on my stable build, then select /src/index.html it should highlight "text/babel" and "text/jsx"? |
This is how should appear with the PR: |
Ah! Ok, thank you. Really. Am I going nuts or have I seen multiple threads saying this was merrged with the master by now? Like the comment above by @MiguelCastillo? Now if I can just figure out what's going on with the multibrowser bugs.. I'm not in a position to complain, but just shocked to see this level of confusion in a project backed by a company the size of Adobe. The JSLint parameter names are funny, though. Evil == eval(). |
@doralang The JSX mode itself was merged to master, but the See @ficristo's instructions how to apply the PR yourself to get it working asap 👍 |
Got it. Thank you! |
Ok - we should be good with mixed mode now. Thank you everyone! |
Looks great! Sorry, but really amateur question here...how do I change the default path for the Brackets package to the new directory I've cloned so I don't have to shift-click every time? Seems it should be in one of the json files in /Library/Application Support/Brackets/, but don't see any parameters there with that file path. |
@doralang check out the |
Thanks! Even figured out the multibrowser issue. You just need to open the entire project folder in Brackets instead of just the index.html file. |
Similar to issue #10166, but for React
Hey,
Could we please have JS syntax highlighting enabled for script tags that have type "text/babel" (and "text/jsx") ?
Cheers
The text was updated successfully, but these errors were encountered: