Wrong syntax highlighting for PHP file


I don't know what happened but syntax highlighting for one php file stopped to working and also icon next to the file has changed. It shows it's text file instead of PHP .

See the picture in attachment.

How can I fix that ?


Hi Csaba,

That is quite interesting behavior. Does it persist between IDE restarts?

Few suggestions (based on the fact that only one file got affected and the rest .php files seems to be OK):
1) try renaming it to some other type (give another extension) .. and then back
2) try to recreate that file from scratch
3) File | Invalidate Caches if the above will not help
4) (as last option) recreate project (backup and delete .idea folder in your project, then use File | New Project...)


I found this line in workspace.xml :

<component name="HighlightingSettingsPerFile">

    <setting file="file://$PROJECT_DIR$/templates/clue2011/listings/tmpl_list_scripts_cat.php" root0="FORCE_HIGHLIGHTING" />


Seems that I accidentally changed highlighting per file. How can I change it back ?


I would just delete these lines (PhpStorm must be closed, of course).

Better tell us how did you managed to turn custom highlighting on for specific file.


I deleted these lines (I closed IDE before that), but its still there (no highlighting), nothing changed.
Only thing that works is to rename the file , I have to change name before extension. When I renamed it to .css it changed highligting, when I change it back to original name bug is still there.

So if I want it to work I have to rename tmpl_list_scripts_cat.php  to e.g. tmpl_list_scripts_category.php

So I decided to create copy, then delete original file and then rename copy back to original name, still doesn't work, it remember settings somewhere else.


Have you searched for file name inside of each file in .idea directory, not just workspace.xml?

You can always delete .idea folder and recreate project in PhpStorm.

I had few issues myself in the past and I had to manually edit workspace.xml, but it always worked well for me.


yes, I searched in all files and there was only one occurence I mentioned , I deleted that one, but it didn't help


Well .. you can try searching in your .WebIde10/config folder, but I do not think you will find anything there (this is for application wide settings, not project specific).

Apart of that -- I can only suggest #3 and #4 from my original post .. or wait for one of the developers (they do know their own product better).


Settings|File types|Text files
Check patterns/names that may match this file.


Thank you, thats that, Entire file name was in the registered patters box. Maybe there is some shortcut for this and I accidentally ran it. I don't know. What do you think what I did ?... avoid this in feature


There is one action available that may do such thing .. but it has no default short cut (at least not on my setup).

Settings | Keymap, type in search box (above list of actions) "file type" -- the result will be single action "Associate with File Type" -- check if there are any shortcuts assigned.


No shortcut there. Thanx anyway


Please sign in to leave a comment.