How to add php syntax highlighting to a .theme file?


#1

I’ve startet with drupal 8 and there are files with .theme extension. These files are always php code. Is there a setting, where i can say Atom to view .theme files like .php files?


#2

@finkenmann: I invoked the command “Editor: Log Cursor Scope” (option + command + P) from the Command Pallet within a .php page to show the proper scope name that I was after. I then added the “customFileTypes” object, which assigns the ‘theme’ extension to the scope that I chose, within my “core” namespace in Atom’s config.cson (Atom->Config…). Save and reopen Atom, and you should now have PHP syntax highlighting for your .theme files.

core: customFileTypes: { 'text.html.php' : ['theme'] }


#3

There’s now an entry in the Atom FAQ for this:


#4

Hi,

core:
    customFileTypes: 'text.html.php' : ['theme']

This snippet worked for me, not other one.


#5

The indentation is critical.