Eclipse PDT + code completion does not work at all

I wanted to start a new Zend project, and currently I have to deal with some problems regarding Eclipse PDT ... My problem is that code completion in Eclipse for PHP does not work at all.

I tried many different lessons, etc., for example, creating a new project and importing files; the creation of a new workspace and import projects there; almost all possible combinations of build path and library import settings; delete multiple files in. metadata (you will find many tutorials like this if you conceived it), but nothing worked.

[Edit] PHPNature is also installed (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 a set of PHPNature and the other is not)

[/ Edit]

The problem is in the details: I created a new Zend project and tried to start coding in IndexController.indexAction (). The first thing I did: I typed $this-> , but the code did not end ... I thought maybe I would need to add the Zend library that I did. When I click on Zend_Controller_Action in the class IndexController extends Zend_Controller_Action , I can see the Zend_Controller_Action documentation, I can also press F3 and the file will respond to aggression ... Which means that Zend has been successfully added as a library. I also tried Ctrl + Space , but nothing happens. By the way, standard PHP functions, such as isset() , will also not be displayed at code completion

Does anyone have an idea how to fix this? I am using Eclipse Juno, with Eclipse PDT 3 and Zend Framework 1.x (I don’t know for sure, but it is not ZF2, and it works well if I open http://localhost .

I am grateful for any help

+4
source share
10 answers

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

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

The reason was that the old DLTK index of the workspace does not correspond to the new version and needs to be rebuilt. Launch eclipse and the DLTK index will be restored.

After that, code completion worked.

+29
source

I feel that I also had to deal with this quite often, and the modifications to the .project file mentioned did not help. What helped me with this:

edit the .buildpath file and add

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

My complete build file might look sth. eg:

 <?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 containing php files to the build and enable path (RMB on the project), but I don’t think it was necessary, the most important part was modifying the .buildpath file for me.

Hope this helps ...

+4
source

The standard solution (on the Eclipse forum ) does not work for me. This problem has been fixed:

  • go to "Properties for my project" (right-click on it in "PHP Explorer", then "Properties"),
  • select "PHP Build Path" / "Add Folder"
  • there I marked / selected the main project folder.

It took some time until the DLTK database was updated (it can lock your machine for a couple of minutes, be patient), but then it started to work fine.

+2
source

Delete the workspace /.metadata/.plugins/org.eclipse.dltk.core.index.sql.h2/*. It should work.

Hope this helps!

+1
source

I think this is the best way:

Right-click on a project in the Project Explorer Customize Add PHP Support ...

enter image description here

+1
source

You may need to edit the .project-File and add the tag "Nature of PHP". See this thread for more information. I once had this problem after placing a project running the SVN version, and this seems to be a common problem.

0
source

I found a solution on the eclipse forum. Going to PDT 3.1.2 solved the problem.

Regards, Marek

0
source

After using other possible solutions on this page, I managed to get code completion for working in PDT 3.2 using the latest dynamic language tools 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 link Core Framework > EMF > the runtime version that downloads the zip file, so you will need to perform a local installation: In Eclipse, select Help > Install new software > Add > Archive > to zip file> DLTK type in the Name box and confirm.

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

Option 2. Before I tried to use the previous method, I installed PDT 3.1, which I received 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 this is another possibility.

0
source

I had a similar problem, but it only included one PHP file. Then I discovered that I used the following syntax to initialize a variable inside a method:

 $rule = ($fullValidation)?(new StartTimeRule()):(new NullRule()); 

The problem is using the inline condition. The code worked, but apparently violated some of the features of Eclipse, such as the F3 command, autocomplete, schema view, etc. I could be wrong, but I think this is a DTLK indexer error.

I changed this line with the standard if statement, not the built-in condition, and now all the functions work again.

Hope this helps!

0
source
  • Download ZF2 and put it in your redirected location (~ Frameworks / ZF2)
  • Eclipse: Window> Preferences> PHP> Libraries = Click Create-Button, add a name
  • select the added item and click "Add External Folder" -Button. Select destination ZF2
  • Make sure your project is "Project PHP" (see: "Mark the database of the project base", click "Project on the menu"> "Nature of the project" and select "Project PHP".
  • This will restore your project if Project> build Project is also not selected.

Now everything should work like a charm (on Kepler Service Release 2)

0
source

Source: https://habr.com/ru/post/1487753/


All Articles