SQL code completion not working
Answered
Hi folks,
I noticed that lately code completion is not working in my PHP projects for SQL queries. Does anybody know why this might be happening? Here is an example:

As you can see, the database connection is properly set up. The upper query is complete, but PHPStorm does not recognize it as an SQL query, and it doesn't try to complete the lower one as well.
SQL dialect is set to MySQL for the whole project. I don't know what else to do to make this work again. I am using 2017.1 EAP (build #PS-171.2272.10) but this has been happening for the last few months.
At first I thought it is an issue with the EAP version, but I guess it would be fixed by now if this was a global issue.
Please sign in to leave a comment.
Hello,
Could you run File > Invalidate Caches/Restart > Invalidate and Restart, please, and then check if the issue reoccurs?
Thanks!
Hi Vladimir,
thanks for the tip, but unfortunately it did not help. The issue is still there after invalidating the cache and restarting PHPStorm.
@Zoli
1) Does it recognize SQL in any other file .. especially with very simple SQL query (like "SELECT * FROM session")?
2) Will it work if you do like this (using HEREDOC)?
$query = <<<SQL
SELECT * FROM session
SQL;
3) If you place caret inside such string (in #1 not #2) and press Alt+Enter -- what menu will you see?
4) If still nothing -- please post screenshot of your "Settings/Preferences | Editor | Language Injections"
5) Sharing your idea.log (for last session at least) might also help
P.S. It will be easier if you will be posting screenshots using Default or Darcula color schema -- it's easier to recognize familiar colors/see what potentially might be wrong from this angle (colors may give you some hints) as compared to looking at custom colors.
Damn, I was writing a pretty long response and when I got to the 4th point, I was writing: I don't have the menu item. It was that point when I realized: I did not have the necessary plugin installed... :)
I guess I have uninstalled it when I was trying to figure out what plugins I don't need but didn't notice the lack of SQL code parsing right away.
Thanks for the help!