How to invoke autocomplete for table names (from data source) in .sql file?

I setted up Data Source (MySQL, local server, root username/password). I have autocomplete for tables names in database console tab. How I can get autocomplete at least for tables names in .sql files?
Both Ctrl+Space and Shift+Ctrl+Space deosn't help. See image below.
OS: Win 7 x32;
JDK: 1.6.0_18-b07;
MySQL: 5.0.45-community-nt;
WebIDE(PhpStorm): from 94.583 down to 94.5 or even to more old versions.

Comment actions Permalink

Please check my answer in this post. I use DB navigator for mysql databases and autocomplete works ok.

Comment actions Permalink

Yes, I know about Database Navigator plugin. But WebIDE developers says in the blog there should be autocomplete with bundled plugin Database Support. Therefore my question is, how to invoke autocompletion without Database Navigator.

Currently I don't wish to use Dabase Navigator because it is too slow for me. WebIDE works much faster without it (I tried it on EAP 94.5, maybe now it works faster). And I don't need most of their features. Features of Database Support are enough for me. Currently I can invoke autocomplete for tables and fields names in db console tool window and in sql-injected strings in .php files. All what I need is autocomplete in .sql files too.

Comment actions Permalink

All the tables are in "reduinda_work" database (schema/catalog) which is not imported by default.
So you have to do any of the following:

  • specify "<database>." before each table reference and there will be completion after dot
  • use MySQL "use" statement, i.e. "use <database>;"
  • have "/<database>" part in the Database URL property of the DataSource, i.e. jdbc:mysql://<host>/<database>

The third variant is the best for MySQL.

BTW it seems that SQL Resolve inspection is turned off because all the tables in the file should be yellow.

Comment actions Permalink
have "/<database>" part in the Database URL property of the DataSource, i.e. jdbc:mysql://<host>/<database>

My db source has exactly the same settings. See image below. But there is no autocomplete in .sql files.

BTW it seems that SQL Resolve inspection is turned off because all the tables in the file should be yellow.

No, I didn't turn off inspections. See image below.

Comment actions Permalink

Please ensure that MySQL dialect is configured in Settings/SQL Dialects.
The Generic dialect provides only keyword highlighing and completion so this setting may be the cause of the problem.
If this is not the case then I have to ask some more questions:

Does "Go to declaration" (Ctrl+B) works on `se_languagevars` for example?
Do you have completion in the following sample queries:
"select * from reduinda_<caret-here>"
"select * from reduinda_work.<caret-here>

As far as inspections are concerned the "highlighting level" popup is not enough. You should check whether the SQL inspections are turned on in the inspection profile settings. To check the profile just click on the "Configure Inspections" link that is located under the "Highlighting Level" slider.

Comment actions Permalink

Thank you, Gregory! I didn't selected SQL dialect for my files. There was a problem. But after selecting MySQL dialect the WebIDE started throwing a lot of errors like this:

Element: class com.intellij.psi.impl.source.tree.PsiCommentImpl: Element: class com.intellij.psi.impl.source.tree.PsiCommentImpl
com.intellij.psi.PsiInvalidElementAccessException: Element: class com.intellij.psi.impl.source.tree.PsiCommentImpl
at com.intellij.psi.impl.source.tree.LeafPsiElement.getContainingFile(
at com.intellij.lang.folding.FoldingDescriptor.getRange(
at com.intellij.lang.folding.FoldingDescriptor.getRange(
at com.intellij.codeInsight.folding.impl.UpdateFoldRegionsOperation.a(
at com.intellij.openapi.editor.impl.FoldingModelImpl.a(
at com.intellij.openapi.editor.impl.FoldingModelImpl.runBatchFoldingOperationDoNotCollapseCaret(
at com.intellij.codeInsight.folding.impl.FoldingUpdate$
at com.intellij.codeInsight.daemon.impl.CodeFoldingPass.doApplyInformationToEditor(
at com.intellij.codeHighlighting.TextEditorHighlightingPass.applyInformationToEditor(
at com.intellij.codeInsight.daemon.impl.PassExecutorService.a(
at com.intellij.codeInsight.daemon.impl.PassExecutorService.access$1000(
at com.intellij.codeInsight.daemon.impl.PassExecutorService$
at com.intellij.openapi.application.impl.LaterInvocator$
at java.awt.event.InvocationEvent.dispatch(
at java.awt.EventQueue.dispatchEvent(
at com.intellij.ide.IdeEventQueue.f(
at com.intellij.ide.IdeEventQueue.b(
at com.intellij.ide.IdeEventQueue.dispatchEvent(
at java.awt.EventDispatchThread.pumpOneEventForFilters(
at java.awt.EventDispatchThread.pumpEventsForFilter(
at java.awt.EventDispatchThread.pumpEventsForHierarchy(
at java.awt.EventDispatchThread.pumpEvents(
at java.awt.EventDispatchThread.pumpEvents(

Comment actions Permalink

This problem is unrelated to SQL or Database functionality.
Please use built in error reporting tool or post this trace in tracker.
Make sure you have the latest EAP installed and/or wait for the next one.

Comment actions Permalink

I reported it via built in error reporting tool. But sometimes this tool doesn't send report. And I should press send button second time, sometimes third and so on. Is it because your server is overloaded with error reports?

Comment actions Permalink

There may be various reasons. Anyway we do our best to make it available.


Please sign in to leave a comment.