PHPStorm 9种颜色 [英] PHPStorm 9 colors

查看:121
本文介绍了PHPStorm 9种颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到,如果我只用HTML编辑页面,但将页面另存为.php(页面中没有PHP),则没有代码提示颜色.如果我重新保存为.html,那就有.可能有一种显示颜色的方法吗?

I noticed that if I'm editing a page with just HTML, but save the page as .php (there is no PHP in the page), there are no code hint colors. If I resave to .html, there are. Might there be a way to show the colors?

请参阅下文.

具有PHP扩展名:

(带有HTML扩展名):

推荐答案

这是最新的9.0.1版本中引入的错误.

It's a bug introduced in recent 9.0.1 version.

这个想法是要处理文件名中的双扩展名并自动设置外部语言.这意味着什么:在普通的.php文件中,PHP标记之外的所有文本都被视为HTML/纯文本..但在file.js.php这样的文件中,外部语言(PHP标记之外的文本)最有可能是JavaScript而非HTML.要将其作为JavaScript(语法高亮显示和代码完成/分析),您需要根据每个文件/目录将其手动设置为JavaScript.

The idea was to treat double extensions in file name and setup outer language automatically. What this means: in ordinary .php file all text outside PHP tags is treated as HTML/Plain Text .. but in files like file.js.php the outer language (text outside PHP tags) is most likely will be JavaScript instead of HTML. To have it as JavaScript (syntax highlighting and code completion/analysis) you would need to manually set it up to JavaScript on per file/directory basis.

因此,开发人员决定(经过相应票证的多次投票后)才使这项任务自动化.不幸的是,他们没有很好地检查它如何与其他双扩展名(特别是.inc.php.tpl.php)配合使用,因此当前的行为/错误.

So devs decided (after many votes in corresponding ticket) to automate this task. Unfortunately they did not checked well enough how it will work with other double extensions (.inc.php or .tpl.php in particular) hence the current behaviour/bug.

此问题已得到解决,9.0.2应该很快就会出现(几天).同时,您可以通过几种不同的方式手动修复它:

  1. 您只需重命名文件即可摆脱这种双重扩展名,例如将其设置为header.phpinc.header.php.

或在Settings (Preferences on Mac) | Editor | Template Data Languages中手动将外部语言设置为HTML-在此处找到您的文件,然后在第二列中设置HTML.

Or manually set outer language as HTML in Settings (Preferences on Mac) | Editor | Template Data Languages -- find your file there and set HTML in second column.


更新:(2015年8月18日)


UPDATE: (18/08/2015)

PhpStorm v9.0.2已发布.

PhpStorm v9.0.2 has now been released.

这篇关于PHPStorm 9种颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆