Why does Eclipse code completion not work on some projects?

40,348

Solution 1

Maybe Eclipse doesn't understand the project has a "PHP nature". Try comparing the .project file on both projects to look for differences. It should contain something like:

 <natures>
  <nature>org.eclipse.php.core.PHPNature</nature>
 </natures>

The .project file will be in your workspace under the project directories.

Solution 2

It is just one line to add in the .project file and then restarting eclipse to get codecompletion: Where it says

---
 <natures>
 </natures>
---

after the change has to be

---
 <natures>
  <nature>org.eclipse.php.core.PHPNature</nature>
 </natures>
---

That should do.

Solution 3

@Guido PHPNature does not fix this.

@Edward Tanguay Yes, that's because when you create new PHP project, eclipse adds .buildpath file with

<?xml version="1.0" encoding="UTF-8"?><buildpath>
<buildpathentry kind="src" path=""/>
<buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/></buildpath>

when you import existing project you eclipse does not generates .buildpath file, but you can add it by hand or create new PHP project with existin source (you can choose in wizard).

Solution 4

I have the same issue sometimes. For me it works to rebuild the PHP project with "Project" -> "Clean".

Solution 5

If you have this problem, follow these steps :

  • Select "PHP Include Path" in your project tree
  • Right click on it then click "Build Path>Configure Build Path"
  • On the opening window,add folder that you want to build, so it can do code assist.

Thats all :) I hope it resolves your problem, I solved my one :)

Share:
40,348
Angry Dan
Author by

Angry Dan

web/software developer, .NET, C#, WPF, PHP, software trainer, English teacher, have philosophy degree, love languages, run marathons my tweets: http://www.twitter.com/edward_tanguay my runs: http://www.tanguay.info/run my code: http://www.tanguay.info/web my publications: PHP 5.3 training video (8 hours, video2brain) my projects: http://www.tanguay.info

Updated on August 06, 2022

Comments

  • Angry Dan
    Angry Dan almost 2 years

    I have Eclipse 3.3.2 with PDT doing PHP development. All projects that I create, even SVN projects have code completion. Now I just opened another SVN project and it has no code completion or PHP templates (CTRL-space does nothing in that project). However, I can open the other projects and code completion all work in them.

    Why would code completion and templates be "off" in just one project and how can I turn it back on?