In Sublime Text, to set JSX files to default Babel syntax highlighting, follow these steps:
-
Install the Babel Syntax Package If you haven't installed the Babel syntax package yet, first install it via Package Control. Press
Ctrl+Shift+P(orCmd+Shift+Pon Mac) to open the command panel, type 'Install Package', select 'Package Control: Install Package', then search for 'Babel' and install it. -
Set Default Syntax Highlighting After installing the Babel package, open a JSX file. Click on the syntax name in the bottom-right corner (e.g., it may display as 'JavaScript'), and in the opened menu, select 'Open all with current extension as... > Babel > JavaScript (Babel)'. Once this is set, all
.jsxfiles will default to Babel's JavaScript syntax highlighting when opened. -
Verify the Setting After completing the setup, re-open a JSX file to confirm that Babel syntax highlighting is applied by default.
By following these steps, you can ensure all JSX files in Sublime Text use Babel for syntax highlighting, significantly improving your development experience—especially when writing React components.