Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable highlighting for SQL code in phpstorm?

Tags:

phpstorm

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 " ;
like image 999
albator Avatar asked Mar 23 '14 14:03

albator


People also ask

How do I highlight all detected code problems in PhpStorm?

By default, PhpStorm highlights all detected code problems. Hover the mouse over the widget in top-right corner of the editor and select another level from the Highlight list: None: turn highlighting off. Syntax: highlight syntax problems only. All Problems: (default) highlight syntax problems and problems found by inspections.

How do I re-enable a suppressed inspection in PhpStorm?

To re-enable a suppressed inspection, delete the /** @noinspection */ annotation. By default, PhpStorm highlights all detected code problems. Hover the mouse over the widget in top-right corner of the editor and select another level from the Highlight list: None: turn highlighting off.

Does the generic SQL dialect support completion and highlighting?

The Generic SQL dialect supports completion and highlighting for SQL keywords, table and column names. Syntax error highlighting is disabled, that is all statements in a query console are shown as syntactically correct).


1 Answers

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).

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.

enter image description here

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';

enter image description here

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. 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).

like image 111
LazyOne Avatar answered Oct 19 '22 05:10

LazyOne