Eclipse PDT + Code completion not working at all

2019-03-31 07:49发布

I wanted to start a new Zend project, and currently I'm facing some issues regarding Eclipse PDT... My problem is, that the code completion in Eclipse for PHP does not work at all.

I tried a lot of different tutorials etc, for example making a new project and import the files; making a new workspace and import projects there; almost every possible combination of buildpath settings and library imports; deleting several files in .metadata (you will find lots of tutorials like this if you google for it), but nothing worked.

[Edit] Also the PHPNature is set (thanks to tranisstor):

<natures>
    <nature>org.eclipse.php.core.PHPNature</nature>
    <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>

(It also does not work if there is only the PHPNature set, and no other in addition)

[/Edit]

The problem in detail: I made a new Zend project, and tried to start coding in the IndexController.indexAction(). First thing I did: I typed in $this->, but no code completion came... I thought maybe I would need to add the Zend library, which I did. When I click into the Zend_Controller_Action in class IndexController extends Zend_Controller_Action I can see the documentation of Zend_Controller_Action, I also can press F3 and the corrosponding file will appear... Which means, Zend is successfully added as library. I also tried Ctrl + Space, but just nothing happens. By the way, the standard PHP functions like isset() also won't show up in code completion

Does anybody have a idea how to fix this? I am using Eclipse Juno, with Eclipse PDT 3, and Zend Framework 1.x (don't know exactly, but it's not ZF2 and it works well if I open http://localhost.

I'm grateful for any help

10条回答
孤傲高冷的网名
2楼-- · 2019-03-31 08:25

Remove workspace/.metadata/.plugins/org.eclipse.dltk.core.index.sql.h2/*. It should works.

Hope it helps!

查看更多
【Aperson】
3楼-- · 2019-03-31 08:27

I had the same problem when upgrading eclipse to Kepler. The following worked for me:

Remove files under workspace/.metadata/.plugins/org.eclipse.dltk.core.index.sql.h2

The reason was that the workspace old DLTK index is not compliant with the new version and needs to be rebuilt. Start eclipse and the DLTK index will be regenerated.

Code completion worked for me again after that.

查看更多
女痞
4楼-- · 2019-03-31 08:29

I've found a sollution on eclipse forum. Downgrading to PDT 3.1.2 solved the problem.

Regards, Marek

查看更多
手持菜刀,她持情操
5楼-- · 2019-03-31 08:31

After trying the other possible solutions on this page, I managed to get code completion to work in PDT 3.2 with the latest Dynamic Languages Toolkit in Eclipse Juno.

Juno usually installs DLTK version 4.0 by default so I downloaded DLTK 5.0 from here: http://download.eclipse.org/technology/dltk/downloads/drops/R5.0/R-5.0-201306060709/. Use the Core Frameworks > EMF > Runtime Version link, which downloads a zip file so you will need to do a local install: In Eclipse select Help > Install New Software > Add > Archive > navigate to the zip file > type DLTK in the Name box and confirm.

Use Eclipse's Install new software to get PDT 3.2 from the PDT repository, if it is not already installed: http://download.eclipse.org/tools/pdt/updates/3.2/release

Option 2: Before I tried the previous method I installed PDT 3.1, which I got from the Juno update site (instead of the PDT repository): Install New Software > http://download.eclipse.org/releases/juno. Code completion worked in 3.1, so it's another possibility.

查看更多
该账号已被封号
6楼-- · 2019-03-31 08:32

Maybe you need to edit your .project-File and add a "PHP nature" tag. See this thread for more information. I once had this issue after putting a project under svn version control and it seems to be a common problem.

查看更多
SAY GOODBYE
7楼-- · 2019-03-31 08:33

i feel you, i had to deal with this quite often too, and the mentioned .project file modifications didn't do the trick. What helped me was this:

edit the .buildpath file and add

<buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>

My complete build file might then look sth. like this:

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

i also added my folder which contains the php files to the build and include path (RMB over the project), but i don't think that it was necessary, the most important part was the modification of the .buildpath file for me.

Hope that helps...

查看更多
登录 后发表回答