Webstorm doesn't recognize one of my .js files as a JavaScript file so I'm losing syntax highlighting and being able to add break points. I've looked in the workspace.xml
file and the file in question seems to have similar settings to other .js files that work correctly.
If I change the name of the file it works ok. So somehow Webstorm is stuck on misinterpreting the type of a file that has this name. Where else can I edit the project?
Press Ctrl+Alt+S to open the IDE settings and select Editor | File Types. From the Recognized File Types list, select the file type that you want to associate with other filename patterns.
tip. You can also add files to your local repository from the Project tool window. Select the files you want to add, and press Ctrl+Alt+A or choose VCS | <your_VCS> | Add from the context menu.
"Fantastically intelligent", "Best-in-class ide" and "Many languages support" are the key factors why developers consider IntelliJ IDEA; whereas "Intelligent ide ", "Smart development environment" and "Easy js debugging" are the primary reasons why WebStorm is favored.
So I see three possible reasons for the problem:
The file was marked as 'Plain text'
There is a pattern for 'Text files' file type that matches this file (or back: file type 'JavaScript' exclude this file name). See image below
Updated: after several years I've found one more reason for the behavior and most likely it the main source of the issues. When you create a file without any extensions the "Register New File Type Association" is appeared. And you can accidentally specify a new file type, for some file name. It is can be fixed with (2) but it is the reason why the pattern was added there.
Note: the solution works for all IDEA-based IDEs: IntelliJ IDEA, WebStorm, RubyMine, PyCharm, PhpStorm.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With