Reputation: 331
When I try to use the code autocomplete of IntelliJ by using ctrl+space
it doesn't work.
What do I need to do?
For example, in this code I want to use the add method of List and it doesn't give me the option to.
Upvotes: 5
Views: 6842
Reputation: 6857
Several possible reasons:
Your file doesn't reside in a content root and is not bound to a build path, so it doesn't get the required class definitions and resources needed for code completion. To fix, right click your root source directory -> Mark Directory As -> Sources Root.
Check to see if you accidentally turned on the Power Save mode (File | Power Save Mode). Turning it on minimizes power consumption of your laptop by eliminating the background operations, including error highlighting, on-the-fly inspections, and code completion. Turn it off.
Make sure the JDK for your project is set up correctly in the File | Project Structure window.
A file containing classes and methods that you want to appear in completion suggestions list is marked as a plain text file. To fix, right-click on the file -> Mark as Java class.
External libraries that contain methods that you want to appear in the completion suggestions list are not added as dependencies or global libraries.
Upvotes: 7