how to disable language injections for SQL?

I'm using phptorm and we have lots of sql fragments in strings that we assemble to make the sql.  We then do things like
$sql = "select id from table  $join_clause $where_clause" and this causes the the SQL language injection to complain.

I've disabled all the options in the settings> language injections that relate to SQL but it still independently assumes I have sql and puts in the language injection.

Is there some other way to disable this globally?  

Comment actions Permalink

Hi there,

"Settings | Language Injections" is the way to go. It works fine here on my computer (PhpStorm v7 EAP build 131.98; Windows 7 x64 SP1 ENG) -- if I disable SQL-related entries I do not have SQL language injected into strings in my PHP files any more.

My suggestion: Place cursor in such injected string, press Alt+Enter (or click on light bulb icon) and choose "Un-inject Language" from popup menu -- maybe you are disabling the wrong rule? (although quite unlikely as you said that all SQL rules are disabled).

Another idea: change SQL Dialect to "Keywords only" (Settings | SQL Dialects) -- this way only basic syntax highlighting will be applied, so no inspections should be run (even on "invalid" SQL)

Comment actions Permalink

ok - thanks for the tip about the sql dialects.  I'll give that a try.


Please sign in to leave a comment.