How to set JSX files default to Babel text highlighting in sublime

拈花ヽ惹草 提交于 2019-12-04 08:59:01

问题


I have a babel text highlighting that i added in my sublime. However every time I open a new react project it defaults to javascript text highlighting then i have to reset each javascript file to get the correct text highlighting. As you can see in the lower right of my screenshot it is by default set to javascript.


回答1:


The syntax that Sublime selects is based primarily on the extension that the file has.

You can select View > Syntax > Open all with current extension as... from the menu while you have such a file open to tell Sublime what syntax you want it to use for any particular extension.

If you sometimes use regular JavaScript as well, you'll experience your current problem in reverse; you will have to manually swap the syntax back to JavaScript.

Either way, the Project Specific Syntax Settings package may also be useful in this case if you use projects. It will allow you to configure per project what you want the syntax for different files to be.




回答2:


What I did was to make babel(JavaScript) the default, preventing the default JavaScript by adding it as a value to ignored_packages.

To do this, open your sublime, click on Preferences > settings then paste this in:

"ignored_packages":["JavaScript"]

More details here: https://github.com/babel/babel-sublime



来源:https://stackoverflow.com/questions/43825586/how-to-set-jsx-files-default-to-babel-text-highlighting-in-sublime

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!