Eclipse PDT Intellisense for PHP functions
Asked Answered
M

3

8

So the intellisense works for my own variables, methods, etc. but doesn't work for php functions like in_array... I'm just opening a single PHP file instead of creating a project. It works when I create a PHP project and create a php file inside that project. But doesn't work when opening individual php files.

VS.Php for VS2010 has intellisense for php functions when I just open a single php file. I'd like to emulate this functionality in Eclipse. Does anyone know how to make Eclipse PDT show php functions when opening a file?

Thanks.

Maynardmayne answered 9/4, 2012 at 6:34 Comment(3)
The concept of projects is fundamental in eclipse. i doubt that it is possible. All the settings for autocomplete and others are kept within the .projects folder. I do no think that Eclipse is smart enough for that.Ozalid
How do you open a single file in Eclipse w/o having any project?Goldenrod
I'm not sure what you're asking. I just go File->Open File.Maynardmayne
G
1

Have you tryed netbeans for PHP? I've developed the past 2 years with netbeans+apache+php5+MySQL+MongoDB and used Netbeans all along on Ubuntu machines. The only thing it lacks at the moment is the code completion (intellisense) for the Mongo objects. Other then that it reads your code and complete PHP functions as well. And it's built on top of Eclipse (or at least derived from Eclipse). I think it's everything you're looking for.

Cheers

Grassy answered 21/4, 2012 at 16:59 Comment(1)
I actually tried NetBeans and it doesn't do intellisense for single files either.Maynardmayne
G
1

With Eclipse / Netbeans, you cannot have autocompletion on a single file without a project.

I use Notepad++ : in order to activate autocompletion go to "Settings" > "Preferences" > "Backup/Autocompletion" tab and check the option.

Gazo answered 24/4, 2012 at 12:15 Comment(1)
Hmm, didn't know Notepad++ had that functionality. Thanks for the tip.Maynardmayne
S
1

As far as I know Eclipse doesn't have such a functionality. Eclipse works well in a project context. As I understand it, when you create a PHP project in Eclipse, it adds the PHP core libraries in this specific context. This makes sense because Eclipse support many languages, I use it to develop in C, Java and PHP and I certainly don't want all the libraries loaded at startup or each time I open a file.

To handle your issue, I created 'default' projects. I have 'PHPDefault', 'JavaDefault' and C++Default, each with appropriate settings and libraries. If you need to open a single PHP file from your OS, drag it to your project, if you want to open it from a remote location, copy it to your default project folder and refresh it from Eclipse so it will appear.

The is the only way I know, let me know if it works out for you.

Shantishantung answered 24/4, 2012 at 12:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.