我目前正在评估PhpStorm作为Aptana Studio的替代品,我们现在就使用它。但有一个问题真的很烦人。
我们为PHP模板使用* .tpl文件扩展名。此文件类型通常映射到Smarty。将其设置为“PHP文件(PHP)”非常容易。但是每次我重新启动PhpStorm时,都会收到以下消息:
File type recognized: File extension *.tpl was reassigned to Smarty
所以它将文件类型映射回Smarty。如果我尝试通过“事件日志”“恢复”它,它将把它映射到“文本文件”,但不会回到PHP。
那么,我如何防止PhpStorm触及我的手动更改是保持映射到PHP(而不是Smarty)?
所以以下方法可行:
无需触摸配置:
Preferences > Editor > File Types
设置更改文件类型映射现在PhpStorm不应该再将它映射回来。
触摸配置文件:
在您的用户配置文件中,您应该有一个文件夹.WebIde70/config/options
(或类似的东西),你应该有一个名为filetypes.xml
的文件(如果没有创建一个空文件),你可以在其中设置映射并阻止PhpStorm恢复它。这是一个简单的例子,只有我的问题的映射:
<?xml version="1.0" encoding="UTF-8"?>
<application>
<component name="FileTypeManager" version="11">
<ignoreFiles list="CVS;SCCS;RCS;rcs;.DS_Store;.svn;.pyc;.pyo;*.pyc;*.pyo;.git;*.hprof;_svn;.hg;*.lib;*~;__pycache__;.bundle;*.rbc;" />
<extensionMap>
<mapping ext="tpl" type="PHP" />
<removed_mapping ext="tpl" approved="true" type="Smarty" />
</extensionMap>
</component>
</application>
如您所见,设置文件不仅设置新映射,还删除Smarty模板的原始映射。