Code completion/assist for built-in PHP functions in Eclipse PDT
Asked Answered
P

6

11

I'm writing PHP code in Eclipse PDT (PHP Development Tools), but for some reason it doesn't auto-complete PHP built-in functions, such as "isset()". This is unlike Komodo which also shows the arguments the function recieves. The only thing Eclipse auto-completes are my variables. Hwo can I make Eclipse auto-complete built-in functions?

Predesignate answered 5/8, 2009 at 11:24 Comment(1)
I had a similar problem. The answer refers to a a folder that you have to do a cleanup. See this topic #24658653Mcgaw
D
21

I came across a similar issue and found a fix for it, however, it's a bit of hack as I couldn't find a way to make the change in the Eclipse Menus. Basically I needed to add the following .buildpath file to the root of the project folder:

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

If you already have a .buildpath file you could probably just add the line to the existing file:

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

I believe I came across this issue when I created a project from existing source instead of creating a new project.

Its been a month since you asked your question so hopefully this is still helpful.

Dorcia answered 5/9, 2009 at 1:46 Comment(2)
If you create project via file > new > PHP project, rather then import it adds this by default.Chesney
This also solved a problem I was having with an Eclipse warning: "the declared class X must be named to X" (where the class name had to be exact name of the file with only a .php extension, nothing extra). Adding the .buildpath file with only the con...LANGUAGE entry fixed it -- and this in the 2021-12 version!Hakan
M
5

Right-click on your top-level project folder in PHP Explorer. Go down to the Configure menu-item. Select "add PHP support".

Mckenna answered 11/12, 2009 at 19:48 Comment(2)
the add php support is greyed. i can't click on it.Ingemar
this still makes sense in 2016!Lodestone
L
1

Do you have auto-activate enabled? If you're looking for a prompt as you type you'll need to enable it.

Window->Preferences->Select PHP and then Code assist and it will be the last option in the dialog. You can set a delay time for the prompts as well.

Otherwise, you need to press Ctrl+Enter to make the prompts appear.

Leadwort answered 17/12, 2009 at 19:5 Comment(0)
A
1

in .buildpath, suppress this line if existing :

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

in .project, suppress this line if existing :

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

right click on project > Configure > Add PHP support...

Abdicate answered 15/11, 2014 at 9:10 Comment(0)
C
0

if you go to windows->preferences and look through your php settings, you'll find that some of the auto complete features are not checked

Cook answered 5/8, 2009 at 11:35 Comment(0)
S
0

Latest PDT is bugged all over. Try to make namespaced class and you will end up having autocomplete broken at all. How could they release stable Zend Studio 7.0 with such a bright bug - I don't know.

I'd recommend to stay on elder versions. PHP 5.3 support is incomplete.

Scrap answered 21/9, 2009 at 14:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.