How can I change the file type association of an existing file in WebStorm?

后端 未结 10 1357
予麋鹿
予麋鹿 2020-12-23 00:28

I accidentally created a file with no extension and I chose the wrong file type association. Text Document I think. I renamed it to have the .js extension which is what I

10条回答
  •  悲哀的现实
    2020-12-23 00:41

    I've had this problem in php storm 8.0.3 on OSX.

    I was struggling with a single file that had been added as a text file, but I'd typed in the .js extension.

    I tried deleting and recreating, renaming and renaming back, deleting .idea altogether. Nothing worked.

    I found that PHPStorm had added the entire file name to the list of patterns for a text file.

    ....
    *.txt
    myfile.js
    ... etc
    

    This was obviously overriding all other settings. And futhermore it was in the IDE Config not the project config. So I'm guessing every other project would have suffered the same issue.

    Once I knew where to look it was easily fixed.

    Navigate to:

    PhpStorm > Preferences > Editor > File Types >  Text files
    

    Then find myfile.js in the Registered Patterns panel and delete it. The file should immediately assume it's correct association.

提交回复
热议问题