This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 180239 - [fields] code assist for variables in PHP file in include path not working
Summary: [fields] code assist for variables in PHP file in include path not working
Status: RESOLVED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: PC Windows 7
: P3 normal with 1 vote (vote)
Assignee: rmatous
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-03 15:33 UTC by nairraf
Modified: 2010-05-03 08:43 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Sample Symfony 1.3 project with missing auto-completion (10.12 KB, application/gzip)
2010-02-22 11:27 UTC, lathspell
Details

Note You need to log in before you can comment on or make changes to this bug.
Description nairraf 2010-02-03 15:33:38 UTC
Hello,

Thomas Mysik asked me to open a bug in this forum post:
http://forums.netbeans.org/viewtopic.php?p=62447#62447

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.

The issue:

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:

ide_helpers.php:
<?php
  $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:

$aj

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.

--Ian Farr
Comment 1 nairraf 2010-02-03 15:46:33 UTC
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.
--Ian
Comment 2 lathspell 2010-02-22 08:25:13 UTC
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.
Comment 3 Tomas Mysik 2010-02-22 08:28:32 UTC
(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
> 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.

Please, attach an example project, that would help us a lot.

Thanks a lot!
Comment 4 lathspell 2010-02-22 11:26:53 UTC
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.
Comment 5 lathspell 2010-02-22 11:27:39 UTC
Created attachment 94392 [details]
Sample Symfony 1.3 project with missing auto-completion
Comment 6 Filip Zamboj 2010-02-22 16:06:55 UTC
reproducible 
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
Comment 7 michaelhodgins 2010-04-01 11:18:35 UTC
I'm using Zend Framework and I can attest that this bug is also present for me.
Comment 8 Quality Engineering 2010-04-30 05:00:36 UTC
Integrated into 'main-golden', will be available in build *201004300200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/
User: 
Log:
Comment 9 rmatous 2010-05-03 08:43:22 UTC
Fixed (not ideal though, next improvements, fixes should come into next release):
http://hg.netbeans.org/web-main/rev/5900b68694c3
http://hg.netbeans.org/web-main/rev/c89fc2658062
http://hg.netbeans.org/web-main/rev/83671e2c3b1b