IntelliJ Code Completion not working for new Java classes

前端 未结 16 1896
挽巷
挽巷 2020-12-10 02:10

IntelliJ IDEA 13 has started exhibiting a very weird behavior in my local setup.

Namely, in any new Java class added to an existing project

相关标签:
16条回答
  • 2020-12-10 02:47

    I had a groovy project where somehow the jdk was not set as a dependency, so jdk classes would not autocomplete.

    Fix:

    1. project structure
    2. modules
    3. (your module)
    4. tab Dependencies.
    5. In the field Module SDK, add a jdk.
    0 讨论(0)
  • 2020-12-10 02:49

    I was facing this issue while coding for eclipse-che client extension. Eclipse che modules are all of maven type. My client extension project was an independent module which can be compiled independent of the parent project. When I imported the same structure to Intellij my client-side extension project was not giving suggestions. After I include the client-extension project to the parent module (adding it to pom.xml) the suggestions started showing up.

    0 讨论(0)
  • 2020-12-10 02:50

    Right click on project -> Add framework support -> Select Maven -> Click OK

    0 讨论(0)
  • 2020-12-10 02:51

    The only thing that worked for me was killing IntelliJ (on Ubuntu) and starting it again.

    0 讨论(0)
  • 2020-12-10 02:53

    This is not IntelliJ 13 but a more recent 2017.1.1 Community version. Adding this answer here so that others benefit from a cause that has its roots in the Gradle Configurations.

    Now, in my case too the auto complete, Generate Override methods and other features were not working. What I figured out is that in my project settings, I had multiple configurations for the gradle modules. The moment I cleaned up the rest of the modules and retained the only one (apart from test) I needed for that project, all behaviors were back to normal.

    Also in such cases of Gradle projects, remember to mark all your sourceSet root folders ad the Source folders.

    Edit: If you do not want to create multiple configurations per sourceSet and you are importing a gradle module, on the import screen, you should also disable the Create a module for per sourceSet flag. Without this, I was having to remove the multiple modules after importing the module.

    0 讨论(0)
  • 2020-12-10 02:54

    For followers, one thing that helped me (auto complete only showed cast field instanceof etc.) was that I had opened a maven module that didn't link correctly to its children (it had a commented out submodules section), so IntelliJ just showed the maven java files as basically "text" files with a tiny "j" in their icon in the project pane. Fixing up the root maven pom.xml file to include the children dirs as modules and voila, they are treated as real java files again, woot!

    0 讨论(0)
提交回复
热议问题