37

For some reason, PHPStorm has decided to render any file named root.js as plain text without the JS coloring and debugging. Does anyone know how to correct this issue??? It is driving me crazy!!!

Andrew Rhyne
  • 5,060
  • 4
  • 28
  • 41

2 Answers2

134

Go to IDE Settings -> File types and look for Text files in Recognized file types. There might be an added pattern named root.js

enter image description here


For newer versions this setting is found in Editor -> File types

enter image description here

dan-lee
  • 14,365
  • 5
  • 52
  • 77
  • 4
    [Similar answer for PyCharm](http://stackoverflow.com/a/13374653/104891), applies to all IDEA based IDEs. – CrazyCoder Jan 30 '13 at 22:00
  • Is it possible to change the the "File Types" for current opened file even if the extension didn't match ? – GiDo Sep 28 '16 at 17:36
  • 1
    This is unbelievable, this glitch for specific file name been driving me crazy for a couple of months, and I haven't managed to find out the way to get rid of it. Thanks a lot! Anyone knows the shortcut which unwittingly leads to addition of this specific *file name* to the list of *file types*? – Farside Dec 28 '16 at 15:22
  • This was my problem except instead of Text, it was listed under "Auto-detect file type by content" in the same area. I'm sure I hit the wrong button when creating the file but it was difficult to locate the fix! – Radley Sustaire Feb 14 '21 at 21:46
1

I just tried this in PHPStorm 5.0.4 and I don't have this problem - all the JS is colour coded fine.

I used right-click > New > JavaScript File to add the file.

Fenton
  • 241,084
  • 71
  • 387
  • 401
  • 6
    The problem is due to incorrectly creating the file in the first place - right click > New > File > name: root (no .js). This will register the filename 'root' as type 'text file'. Then renaming it will register 'root.js' as type 'text file' :) Selected answer fixes it. – daviestar Aug 05 '14 at 05:51