No syntax highlighting for one html file

In my project there is an html file which has no syntax highlighting.

I created it initially by mistake as a file with no extension and there was something in the file's context menu like "interpret this file as HTML" or something like this. So I clicked it  and the syntax was highlighted. Then after some time I renamed it (on disk) by adding html extension.Then  in PHPStorm the syntax highlighting and icon was gone for this file.
scr.JPG
scr1.jpg

If I rename this file to description-panel_1.html or even back to description-panel (without extension) then the html syntax highlighting appears and the icon changes back to green html icon. But if I rename it back to description-panel.html the syntax and the icon is gone. I tried to delete and re-create the file, to invalidate the cache and restart PHPStorm but it's still the same. It looks like PHPStorm has this particular filename remembered somewhere and associated with txt format. Any ideas how to deal with it?

6 comments

Hi there,

Settings/Preferences | Editor | File Types

Check both "HTML Files" as well as "Text Files" and delete offending entries (in first it should be "description-panel" and second should have "description-panel.html")

8

Thanks, it fixed the issue. (I checked the Text Files before but never scrolled down to the bottom because I thought there are only extensions and not whole filenames.)

1

This helped me, too. Thanks!

-1

Is really a Horror how the file handling is made. Can you please guys make an effort to make it better ?

I have the same problem with Codeception tests. Simply renaming a file to WhateverCest.php  removes syntax highlighting like if the IDE was not understanding that is php.
Rename it again to WhateverTest.php and voila! It's PHP again.

No idea what misterious feature is running in the background. But it's not any way that I expect an IDE to react.

0

Looks as if the *Cest.php pattern is assigned to Text file type; please check the registered patterns in Settings | Editor | File types -> Text file type - can you see any patterns with .php suffix there?

1

Yes that was it. It seems with some weird key combination that I'm not aware of I added one file into FileTypes -> Text (Only a complete filename was doing this ;)

So thanks was not even aware of this one till now.

0

Please sign in to leave a comment.