I'm using Sublime 3 on MacOS 10.15.7 and I'm working on a React project.
I have a package installed for JSX syntax highlighting, and it works fine if I manually set it after opening the file. By default, it starts with JavaScript highlighting every time I open the files because my component files have .js extensions. (There are reasons for this.) Is there a way for me to configure Sublime to open these project files with JSX highlighting automatically? If it helps, I also use editorconfig.
NOTE: I don't want to force Sublime to globally open ANY js file as JSX because that will cause the reverse problem with all my Node.js / JavaScript projects. I need a solution that is project-specific.
Thanks in advance!
Sort of related to: Syntax specific settings in sublime-project settings file
Just go to:
View > Syntax > Open all with current extension as ... > JavaScript >
Then select JSX. It will open all JS as JSX, you can confirm it when you see the type of the file at the bottom right of the sublime window.
With further digging, I found this package which appears to enable this feature: https://github.com/reywood/sublime-project-specific-syntax
But I'd prefer a native solution, if possible.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With