Auto complete doesn't find classes on classpath

Answered

Hi

For some reason intellij does not autocomplete certain classes even though they exist on classpath.

Maybe it has to do with stale Maven dependencies, not sure. Seems like the class is indexed only
after spelling out the fully qualified class name and hitting alt+enter.

Another slight variant of the problem above. Say you have two classes called AbstractList and AbstractMap.

Sometimes intellij choose to autocomplete only one class from a set of classes with matching letters in the beginning.
The remaining set of classes is shown only after you typed the first letter that separate them.

Im running with default settings.

Cheers,
-Kristoffer

4 comments

I would double check my module settings. Usually when auto-complete stops finding classes it's a sign of trouble. You might have the class dependency in a different module or scope than what Idea expects. This could cause things to be found during execution but not available for completion. These issues are tough to resolve as they require you understand how modules are bundled/built by Idea vs other build systems. The problem is further coplicated if you use an external build system such as Ant/Maven/Gradle as these settings may or may not be in alignment with your IDE. Regarding classes with similar names, you may appreciate IntelliJ's camel-case completion. You can type "AM" instead of typing "AbstractM" to bypass "AbstractList" and complete "AbstractMap". Idea will consider all letters you type and match them against the uppercase letters in its completion list saving you frustration.

0

Ok, but it still strange that intellij finds the classes when you give it a little bit of help. Its just annoying when you dont know exactly the name of the class.

The maven dependencies are fine, works in eclipse. Hmm. I have tried lots of different setting and feel a little lost.

Any concrete pointers?

1

I’ve exactly same problem. Jet brain support doesn’t help me asking me my ‘logs’ : I can’t believe it.
This is a serious bug : I’m the only one a a team of 8 developer to have this problem. The origin is probably a bad configuration with maven though I can’t find any solution,
Problem occurs also within a module : a class in some package cannot be found by auto completion from an other package in same module. But when I write the exact package name and class in import, compilation is OK.
Did anyone find a solution to this problem?
I think I’ll go back to Eclipse as this is loosing a lot of time and Jetbraind support can’t help

0

The logs are needed to check if there are some problems (e.g. with caches or installation was corrupted etc). Can you build project by Maven form command line?

Try File | Invalidate Caches/Restart.. | Invalidate and Restart. Re-import project from Maven completely via File | New | Project from Existing Sources and select main pom.xml file to import from. Try disabling 3rd plugins. Try latest version from https://www.jetbrains.com/idea/download

If issue remains, do you have a sample project to check?

0

Please sign in to leave a comment.