Search code examples
sublimetext3jsxsyntax-highlightingeditorconfig

How to make Sublime 3 open .js files with JSX syntax


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


Solution

  • 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.