All PHP files are opened as syntax HTML

Matt Rusiniak 9 years ago updated by Phillip Harrington 6 years ago 4
No matter how many times I set view -> syntax -> open all files with current extension as PHP, all of my PHP files (*.php) are being opened in HTML syntax form.

Using dev build 2029
I actually think this is by design from TextMate. Probably not a bug but a "feature"

Here's what I've noticed is happening for me in Sublime Text 3 on Mac OS X:

To set this up, make a folder, and make 3 files in it. An HTML file, a PHP file, and a plain TXT file. Put some appropriate content in each.

1) Open Sublime Text with a previous state of 'no files open'.

2) Open the HTML file. The syntax in the bottom right corner displays HTML, and the menu has HTML checked. Also, selecting Preferences > Settings - More > Syntax Specific - User will open the HTML syntax prefs file.

3) Now open the PHP file. The syntax in the bottom right corner displays HTML, but the menu has PHP checked. Selecting Preferences > Settings - More > Syntax Specific - User will open the PHP syntax file.

Now, do all of the steps above, but start with PHP. The experience will be the same, just backwards. So it looks like when switching between HTML and PHP, which ever one you edited first will be displayed in the bottom right corner, although it is not currently selected.

Also seems correct:  if you go into the Syntax Specific - User file for each of those languages and set a different color scheme for each, for instance...

Make the HTML file:

"color_scheme": "Packages/Color Scheme - Default/All Hallow's Eve.tmTheme" }

The PHP file:

"color_scheme": "Packages/Color Scheme - Default/Monokai Bright.tmTheme" }

And then also change your default color scheme to a third scheme in Preferences > Color Scheme menu (or the Preferences > Settings - User file)...

Then opening the TXT file will use the default, and the HTML and PHP files will also use their appropriate settings. This was broken for me before - an HTML file would open with PHP syntax highlighting.

I'm going to try installing my packages back in one at a time and see if a certain package breaks it again...

Using Sublime Test 3 Build 3047 btw.

Reinstalled all my packages... everything seems to be working fine - correct syntax & indenting per language... correct syntax specific files... just seems to be which ever file - html or php - you happen to open first after starting up will be "sticky" in the displayed syntax in the bottom right corner. Everything else is correct...