views:

43

answers:

3

Im using eclipse PDT to develop a php project. There are several pieces of external code that we need to include (eg PHPExcel). Is there a way to set up my project so that i can get the auto suggestions from these classes etc whe typing the code but not get the list of validation problems and "todo"s that tey have? Perhaps i need to set up my project differently? At the moment the project root is the source folder.

A: 

You can add them as PHP Library in Preferences->PHP->PHP Libraries however I'm not sure that you will have autocompletion from them, it's been a while I used PDT. But I suspect you do.

Redlab
The code is already in the project (so that it is stored in SVN etc). I think libraries are technically "outside" of the project, yes? (PS thanks!)
YakobeYak
yes they are physically outside the project
Redlab
A: 

As far as I know, you get all of it - code completion, validation warnings, todos - or none of it. The easiest way to get them is to have the includes for each of the libraries in your include path, preferably early on before runtime-conditional logic kicks in.

Alternatively, I've been using NetBeans for 6+ months and the code completion there is excellent too: http://daveyshafik.com/archives/743-netbeans-for-php-continues-to-impress.html

CaseySoftware
indeed , for PHP Netbeans might even be a better altenative then eclipse with pdt at the moment.
Redlab
I was afraid that this might be the case. I'll continue to look just in case.
YakobeYak
For others trying to figure out how to add PDT, I wrote this last post last month: http://www.phparch.com/2010/05/31/making-flex-builder-php-friendly/
CaseySoftware
A: 

Hello! Have you already tried (on PHP Explorer) "(project) properties" > PHP Include Path > Librairies > Add External Source Folder... ?

My configuration is Eclipse (Galileo 3.5.2) IDE for Java Developpers (1.2.2) + PDT plugin (2.1.2)

Edited :

I'm not sure if what you want to accomplish worth the effort, but you could try to configure "Validation" and "Todo lists" separately :

Validation

Remove your "libs" directory from Build Path ( (Right-click on the directory : Build Path > Remove from build path or Build Path > Exclude)

Todo list

Avoid parsing your "libs" directory :

  1. On the task's view, you hit "Configure contents...".
  2. On the left, you update an existing configuration or create a new one.
    • Select a new Scope : "Scope" > "On working set".
    • Hit the "Select" button > "Selected working sets" option.
    • Create or update a working set, avoiding the "libs" directory.

After all this, you Rebuild your project and hopefully, you'll get what you asked.

JonG
Would the code i add using this method have to be outside of the project? Because the code is in a folder inside the project because it must also be stored in subversion.
YakobeYak
I think this is getting close. But if i exclude the "libs" dirctory from the build path then the code completion does not work anymore.
YakobeYak
I'm sorry... When I edited my original answer I forgot to mention that, after you configure "Validation" and "Todo list" separately, you do what I first suggest in my answer : You add your "libs" folder as an External Library and it should work.
JonG