Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable autocomplete/syntax-highlight for PHP core functions in Eclipse?

I searched a lot, checked many times the neccesary steps, but it still don't work.

My environment is :

  1. Latest eclipse for PHP developer package

  2. Project is newed, not check out directly from SVN

  3. .project has a line

    <nature>org.eclipse.php.core.PHPNature</nature>
    
  4. .buildpath has a line

    <buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
    
  5. .settings/org.eclipse.core.resources.prefs has a line

    include_path=0;/projectname
    
  6. file ensured opened in PHP Editor

Something works:

  1. PHP core function defination displayed when mouse over, and Ctrl+Click will open its defined file, but input 'arr' nothing happens, while a list of array functions expected
  2. Autocomplete does work for internal functios/variables such as class members But never works for PHP core functions, neither syntax highlighting
like image 367
Edward Avatar asked Aug 18 '09 13:08

Edward


3 Answers

Right-Click on your project -> Configure -> Add PHP Support...

Works for me on Eclipse 3.5 / PDT 2.1

like image 112
Benjamin Cremer Avatar answered Nov 05 '22 19:11

Benjamin Cremer


For me, nothing worked, except:

  1. Backup and then delete the .db files under: /.metadata/.plugins/org.eclipse.dltk.core.index.sql.h2/
  2. Restart eclipse.

I got this tip from #4 in: http://www.nwiresoftware.com/blogs/nwire/2010/09/five-tips-speeding-eclipse-pdt-and-nwire

like image 44
tman Avatar answered Nov 05 '22 20:11

tman


As noted before the 'natures' node for php core is listed but this is most insufficient when the project is imported or checked out.

  • Make a backup of your .project
  • Remove the 'natures' node children
  • Close/Re-open eclipse
  • Right-click project -> Configure -> Add PHP Support
  • Add back other 'natures' children

The issue is that project will not make the necessary imports because it assumes it already has.

like image 15
Patrick Avatar answered Nov 05 '22 20:11

Patrick