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?

3

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")

12

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
Avatar
Permanently deleted user

This helped me, too. Thanks!

0
Avatar
Permanently deleted user

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?

2
Avatar
Permanently deleted user

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.

1
Avatar
Permanently deleted user

With such a great product, the below is moot or less priority then even nice-to-have. Elena has provided an excellent solution! Thank you!

For Windows, Ctrl + Alt + S is a shortcut to Settings. Typing "Recognized" besides the magnifying glass filters to File Types.

As a user, if the file does not begin with a period and it exactly matches (i.e. not a partial, regex, or wildcard match) text within a specified file type, it would be helpful for some type of warning, notice, or right-click ability existed to navigate to Settings-> Editor -> File Types -> [first matching file type] selected.

0

请先登录再写评论。