我不小心创建了一个没有扩展名的文件,我选择了错误的文件类型关联.文字文件我想.我将它重命名为.js扩展名是我想要的,但现在它没有任何语法突出显示.WebStorm不会将其视为javascript文件.我无法在任何地方找到WebStorm处理此文件的方式.我已经尝试重命名它并重命名它,但这不起作用.使用任何其他名称(扩展名为.js),它将其视为javascript文件,但不是原始名称.
我怎样才能解决这个问题?WebStorm文档没有帮助.
小智 226
在Settings(或Preferences适用于Mac)> Editor> File Types您可以编辑该文件被某种类型或其他相关的模式.
如果选择了错误选择的文件类型的模式(在您的案例Text类型中),则可以删除创建的文件名模式,以将文件的文件名关联为错误类型.
然后单击Apply>OK
Hen*_*nry 194
我在OSX上的php storm 8.0.3中遇到过这个问题.
我正在努力使用已添加为文本文件的单个文件,但我输入了.js扩展名.
我尝试删除并重新创建,重命名和重命名,完全删除.idea.没有任何效果.
我发现PHPStorm已将整个文件名添加到文本文件的模式列表中.
....
*.txt
myfile.js
... etc
Run Code Online (Sandbox Code Playgroud)
这显然超越了所有其他设置.此外,它在IDE Config中不是项目配置.所以我猜其他所有项目都会遇到同样的问题.
一旦我知道在哪里看,很容易修复.
导航:
PhpStorm > Preferences > Editor > File Types > <highlight> Text files
Run Code Online (Sandbox Code Playgroud)
然后myfile.js在Registered Patterns面板中找到并删除它.该文件应立即假定它是正确的关联.
小智 5
So much answers and everything is close but no one as in my case.
A had an issue with .vue files. My old PHpStorm version did not track the .vue files, so I somehow associated them as .js files. However, this was a mistake because the syntax is different and I saw a lot of "mistakes" in the code.
Yeah, the solution is really in Settings (or Preferences for mac) > Editor > File Types dialogue. In the window you can see the list of possible associations. At the very bottom of the list you'll see the Vue.js Templates and I had no associations in the bottom window (see the pic), so I manually added *.vue association after clicking green "+".
I think this would be right for any proper file type added to PHPStorm. However, you can add your own file type.
Jos*_*mes -4
经过大约一个小时的搜索和搞砸后,我找到了解决办法:
我将该文件(通过重构命令)重命名为临时文件名。然后我创建了一个具有正确名称和 .js 扩展名的新文件并且它起作用了,然后我将代码从原始文件复制到了具有正确扩展名的新创建的文件中。
我想选择“新的 javascript 文件”并做同样的事情也会起作用。
| 归档时间: |
|
| 查看次数: |
56215 次 |
| 最近记录: |