6

What is:

On Host machine:
Windows 7 Eclipse for PHP Developers
Version: Helios Service Release 2

On guest machine: Linux debian squeeze

I want to edit my remote project through SSH in Eclipse by using RSE. All is okay, I do so in Remote System Explorer perspective:

screenshot1

Then I go to PHP perspective. Right click on project->Configure->Add PHP Support. And press Ctrl+Shift+Space or Ctrl+Space. No completions (code assist) available.

screenshot2

Okay I'm found this bug (at 2008) and solution description (at 2009): Bug 251496. I did so:

Here's my solution to the problem: I just deleted the RemoteSystemsTempFiles project in the PHPExplorer View and than recreated it as a PHP Project (New->PHP Project, ofcourse it has to be named again RemoteSystemsTempFiles). This worked for me, now code completion is ok, hope this helps.

screenshot3

It does not solve the problem. Because PHP Language library does not have Core API maybe... Help. Thanks.

  • 1
    I found a solution! Just create a dummy project (`localhost` for example) and import Core API in this dummy project. `Right click on dummy project->Import...->General->File System->`. Then `Right click on your project->Include Path->Configure Include Path...->Projects->Add...->`. That's all! Code completion is working now. – Dmitry Ponomarev Dec 22 '11 at 21:57
  • Or if you don't want to create a project, just go: Right click on your project->Include Path->Configure Include Path...->Libraries->Add Library->Configure->New...->Click the newly created->Add External Folder-> Probably a bit less hacky, but it still feels messy. I wish there was a proper fix. – Will Sewell Nov 21 '12 at 01:42

3 Answers3

6

Autocompletion for the PHP project (classes, functions...):

I found that adding the folowing lines to the .project did solve the autocompletion issue for the classes of the PHP project itself but did not work with native PHP functions:

<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
<nature>org.eclipse.php.core.PHPNature</nature>

I found a way around it:

Autocompletion for the native PHP functions (print_r()...):

You have to go to your eclipse configuration folder and find the PHP language folder:

In my case: C:\Program Files\EclipseSF2\configuration\org.eclipse.osgi\bundles\276\1\.cp\Resources\language\php5.3

Then you can:

  • right click at the root of your eclipse project,
  • then go to build path
  • link source
  • browse: and link to this folder...

This allows the autocompletion for native PHP function!

Autocompletion for the Symfony framework:

For people using the Symfony framework you can add to your .project file the following lines:

<buildCommand>
        <name>com.dubture.symfony.core.symfonyBuilder</name>
        <arguments>
        </arguments>
</buildCommand>
Andrew Barber
  • 39,603
  • 20
  • 94
  • 123
OlivierLarue
  • 2,234
  • 27
  • 28
  • This is the best solution i found on the web! 10x alot man. Onlt with the first two rows org.eclipse.wst.jsdt.core.jsNature org.eclipse.php.core.PHPNature evertyhing started working, not only the autocomplete in classes but also the native PHP functions. THANK YOU! – Lachezar Raychev Oct 31 '13 at 09:55
4

When using RemoteSystemExplorer, there is a hidden project "RemoteSystemExplorer" in your workspace.

Close eclipse first. I have edited the .project file there and added the line:

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

within the Tag <natures>. And added the file .buildpath with the following content:

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

Starting eclipse and php autocompletion is working. I have done this workflow with "eclipse Kepler".

jabubo
  • 169
  • 9
  • Worked perfect for me in Eclipse 5.2 (Mars). It even auto-completes other remote PHP files I have open, but aren't part of any particular project. Exactly what I was looking for. – Richard Aug 17 '16 at 14:59
  • Thank you from almost four years later, this still works. Also using Eclipse Neon – Mike Apr 07 '17 at 14:02
2

Solution:

1) Close Eclipse.

2) Go to project path.

3) Open ".buildpath" with text editor (gedit, VIM, notepad, etc).

4) Add next line after "buildpath" line:

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

Example:

Before:

<?xml version="1.0" encoding="UTF-8"?>
<buildpath>
    <buildpathentry kind="src" path="library"/>
    <buildpathentry kind="src" path="public"/>
    <buildpathentry kind="src" path="application"/>
</buildpath>

After:

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

5) Save file and exit!

6) Open Eclipse.

7) WORK!

t0mm13b
  • 34,087
  • 8
  • 78
  • 110
Eduardo Cuomo
  • 17,828
  • 6
  • 117
  • 94