Thomas Mysik asked me to open a bug in this forum post:
basically, I have been using netbeans for PHP for years, and what I am about to describe worked in previous versions, but no longer functions in 6.8. I can confirm that it does work as expected in 6.7.1 on multiple PC's, but the below issue does not work on any of those PC's in 6.8 - so it looks like it is repeatable pretty easily.
I am using CakePHP. And in CakePHP, there are "Helpers" that are available to CakePHP views. In order to get code completion to function, it was pretty well known that all that was needed was to create a PHP file like the following:
$ajax = new AjaxHelper();
and place it somewhere in the netbeans project includes path. It also should be specified that the cake framework has to also be in the projects includes path.
With that setup, in one of your CakePHP view files, which are .ctp files, you got code completion for the $ajax variable/object automatically.
In previous version of netbeans - this worked flawlessly, but in 6.8, this no longer works. In your .ctp view file, if you start typing:
and then press control->space, the code assist will tell you that $ajax is a possible match, and that it is defined in ide_helpers.php. If you let code assist complet the word (or just complete it yourself), and try and get code assist for it's methods/properties:
$ajax->[control->space to get code assist]
code assist tells you that there are "no suggestions". Again, this worked without any issue in 6.7.1.
I tried playing with the different code assist options (project PHP set to 5.1/5.2 or 5.3, Tools > Options > Editor > Code Completion > PHP options were turned on, off in almost all possible combinations)...but nothing worked to get the code assist to work in 6.8 for the above issue.
I hope I have been clear enough.
Thanks again, as I really like using netbeans for my PHP development.
I guess I should have mentioned that AjaxHelper is a builting CakePHP object that is automatically available to CakePHP views, and that the .ctp CakePHP "view" files are just php files with a .ctp extension.
I also should have mentioned that I associated .ctp files with PHP files in netbeans already, so that when a .ctp file is opened, netbeans recognizes it as a PHP file and you get syntax highlighting/code assist for them.
Sorry about that.
I experience the same problem but on Linux and not with CakePHP but with Symfony. Sometimes autocomletion works, sometimes not although the variable is explicitly assigned with "new SomeClass()". The SomeClass() itself is auto-completable so NetBeans does know about it. Just the assigned object variable then offers not auto-completion. In case that matters here my exact version:
Product Version: NetBeans IDE 6.8 (Build 200912041610)
Java: 1.6.0_12; Java HotSpot(TM) Client VM 11.2-b01
System: Linux version 2.6.30-bpo.1-amd64 running on i386; ISO-8859-15; de_DE (nb)
I also double checked the Tools -> Edit -> AutoCompletion settings as well as those of the include paths.
(In reply to comment #2)
> I experience the same problem but on Linux and not with CakePHP but with
> Symfony. Sometimes autocomletion works, sometimes not although the variable is
> explicitly assigned with "new SomeClass()". The SomeClass() itself is
> auto-completable so NetBeans does know about it. Just the assigned object
> variable then offers not auto-completion. In case that matters here my exact
> Product Version: NetBeans IDE 6.8 (Build 200912041610)
> Java: 1.6.0_12; Java HotSpot(TM) Client VM 11.2-b01
> System: Linux version 2.6.30-bpo.1-amd64 running on i386; ISO-8859-15; de_DE
> I also double checked the Tools -> Edit -> AutoCompletion settings as well as
> those of the include paths.
Please, attach an example project, that would help us a lot.
Thanks a lot!
Attached you find a tarball of a new created Symfony 1.3 project.
It's a lot automatic generated stuff in there but just focus on
apps/frontend/modules/test/actions/actions.class.php and the following lines:
$this->form = new ManageUsersForm(); // auto-completion works with this class!
$this->form-> // CTRL-SPACE but no completion to e.g. configure()!
The ManageUsersForm is in lib/form/doctrine/ManageUsersForm.class.php.
The standard PHP functions are (apparently) all available in auto-completion.
I have a NetBeans project include to ~/workspace/Symfony-1.3/lib which is the
lib directory from public accessable SVN checkout of http://svn.symfony-project.com/branches/1.3/
Hope that helps.
Created attachment 94392 [details]
Sample Symfony 1.3 project with missing auto-completion
it works in case
$a = new ManageUsersForm;
$a-> //code completion works
$this->form = new ManageUsersForm();
$this->form-> //code completion doesn't work
Product Version: NetBeans IDE Dev (Build 201002152000)
Java: 1.6.0_16; Java HotSpot(TM) 64-Bit Server VM 14.2-b01
I'm using Zend Framework and I can attest that this bug is also present for me.
Integrated into 'main-golden', will be available in build *201004300200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Fixed (not ideal though, next improvements, fixes should come into next release):