如何禁用phpstorm中的SQL代码突出显示? [英] How to disable highlighting for SQL code in phpstorm?

查看:709
本文介绍了如何禁用phpstorm中的SQL代码突出显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在phpstorm中禁用突出显示SQL代码? 我曾经禁用所有SQL检查..但是颜色和字体规则仍然过高 我的php字符串颜色规则. 这是我要实现的示例:

How to disable highlighting for SQL code in phpstorm ? i ever disabled all sql inspection..but color and fonts rules continue to overight my php string color rules . Here is an Exemple for what i want to achieve :

$var_php = " all text here is red , SELECT * and whatever sql code is in red too " ;

推荐答案

SQL语言自动注入包含SQL代码的字符串中(这些字符串由典型模式检测,例如select xx from等).如果使用特殊标签(SQL),它也会注入HEREDOC/NOWDOC.

SQL Language is automatically injected in strings that contain SQL code (which are detected by the typical patterns, e.g. select xx from etc). It also injected in HEREDOC/NOWDOC if you use special label (SQL).

您可以禁用这些(在下面的屏幕快照中选择)和任何其他不需要的注入规则,或者在Settings/Preferences | Editor | Language Injections上创建自己的注入规则.

You can disable these (selected on the screenshot below) and any other unwanted injection rules or create your own at Settings/Preferences | Editor | Language Injections.

PS .由于您根本不需要任何SQL/DB支持,因此可以完全禁用SQL/数据库支持插件.

P.S. Since you do not need any SQL/DB support at all, you may just disable SQL/database support plugins completely.

如果您总体上喜欢这样的注入,但是只是不希望仅在特定位置进行注入(例如,由于假阳性匹配),则可以在该字符串中强制使用纯文本.例如:

If you do like such injections in general but just do not want them in a specific place only (e.g. because of the false positive match) then you can force plain text in that string. For example:

$str = /** @lang Text */ 'Select all entries from my cool database';

请注意,此类注释必须放在实际字符串之前(以便可以在函数调用参数等中使用),而不是像普通的PHPDoc注释一样放在整个变量赋值/声明之前.

Please note that such comment must be placed just before the actual string (so it can be used in function call params or alike), not before the whole variable assignment/statement like ordinary PHPDoc comments.

P.S.其他可能的方法也一样:在语言注入规则未自动检测到的某些字符串中强制执行SQL(例如,当字符串拆分为连接位或使用未知/意外序列/语法时).

P.S. The same is possible other way around: force SQL in some string that is not autodetected by Language Injection rules (e.g. when string is split into concatenated bits or uses unknown/unexpected sequence/syntax).

这篇关于如何禁用phpstorm中的SQL代码突出显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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