SQL language injection autocomplete


I've been using the database support for PhpStorm for a while now, and one thing has been bugging me- and I can't figure out if I'm missing a setting somewhere or if this is just a feature that is yet to be implimented.

The autocomplete is awesome for showing you available table/column names, but I've found that it works much better in the database console than just in inline language injection. If I have a select statement like this:

$sql = '
  FROM tblUser user WITH (NOLOCK)';

For some reason, when I'm editing this in a php file just as sql language injection, I won't get autocomplete options for the columns in tblUser. Similarly, as i start typing out the table name itself, I also don't get autocomlete options. However, if I'm editing this sql select in the db console, or I hit <alt>+<enter> and select "Edit SQL Server Fragment", I get autocomplete in both cases. PhpStorm is definitely aware of the db objects, because as soon as I finish typing out the names of the tables/columns, it highlights them to show that they're recognized (and if there's a typo they aren't highlighted).

Does anyone know if I just need to check off an option somewhere under language injection, or is this just not a feature yet?


1 comment
Comment actions Permalink

Hi Mike

I just entered this skeleton:

$query = "SELECT  
  FROM oto_members"
Now if I go back to enter columns, ie put the cursor on the middle line, I can start to type a column name and the picker comes up with autocomplete possibilities 
or I can just press ctrl-space on the empty line and the picker comes up with all fields.

This is in 10.0.3 64 bit.

If I give the table an alias

$query = "SELECT  
  FROM oto_members om"

then as soon as I type om. on the empty line, the full column list appears.

I tried including the rest of your syntax in case it broke it but it worked as expected all the time.


Please sign in to leave a comment.