How to set default syntax highlighting in Atom for Twig files?

According to this answer, this functionality should be built into Atom, and I should use customFileTypes to achieve this. This is what my config looks like:

 "*": "exception-reporting": userId: "" welcome: showOnStartup: false core: themes: [ "atom-light-ui" "atom-light-syntax" ] customFileTypes: "source.twig": [ "html" ] editor: invisibles: {} tabLength: 4 showIndentGuide: true showInvisibles: true 

Please note that I removed the userId value for security, but I have it in my actual configuration.

Oddly enough, if I switch the customFileTypes order to themes , my theme breaks. Why is this?

More importantly, how do I configure all .twig files to use HTML syntax highlighting (or HTML Mustache?)?

+6
source share
2 answers

I was looking for the same thing so that the php-twig package also works for html file types, and also allows you to render the html syntax. I changed your source.twig to text.html.twig , which seems to work:

 "*": core: customFileTypes: "text.html.twig": [ "html" ] 
+2
source

After installing this package, I got Twig support: https://atom.io/packages/php-twig

0
source

All Articles