How to Change Syntax for a Specific Folder in Sublime Text 3
I Write Js Projects in Es5 and Es6. I Installed Babel-Sublime for Highlighting Babel Supported Code. Now, I Open A. Js File Written in Es6, Goto "View ->...
I write JS projects in ES5 and ES6. I installed Babel-Sublime for highlighting Babel supported code. Now, I open a .js file written in ES6, goto "View -> syntax -> Open all with current extension as : Javascript (Babel)", but this causes my ES5 code to also switch to Javascript (Babel). Basically,the JavaScript (Babel).sublime-settings file is updated in the User folder with the extension mapping and the change is applied globally to all my projects. So, is there a way to specify "syntax to extension" mapping per folder or per project basis
1 Answer
First you can specify project-level settings using your_project_name.sublime-project file. Take a look at Project menu and the sublime documentation.
Though, sublime doesn't support syntax settings in the .sublime-project files. So you have to use Sublime Project Specific Syntax package. This works for me with Sublime Text 3. Pay attention to use the Project Specific Syntax > Copy syntax setting to clipboard menu item.
For Babel-Sublime syntax highlighting following should work:
{
"folders":
[
{
"path": "."
}
],
"syntax_override": {
"\\.js$": ["Babel", "JavaScript (Babel)"]
}
}