Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 387751 - Content Assist should be able to show variables from include, include_once, require and require_once expressions,if the included file is in inludepath library
Summary: Content Assist should be able to show variables from include, include_once, r...
Status: RESOLVED FIXED
Alias: None
Product: DLTK
Classification: Technology
Component: Common (show other bugs)
Version: 4.0   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: 5.0M4   Edit
Assignee: dltk.common-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-22 02:47 EDT by Zhongwei Zhao CLA
Modified: 2012-11-29 06:55 EST (History)
2 users (show)

See Also:


Attachments
patch (1.65 KB, patch)
2012-09-24 00:57 EDT, Zhongwei Zhao CLA
alex.panchenko: iplog+
Details | Diff
patch (842 bytes, patch)
2012-09-24 00:57 EDT, Zhongwei Zhao CLA
no flags Details | Diff
Fixed patch (898 bytes, patch)
2012-10-18 14:34 EDT, Natalia Bartol CLA
alex.panchenko: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Zhongwei Zhao CLA 2012-08-22 02:47:13 EDT
add phpuint library to a php project,and then add the following line in a php file:

require_once 'PHPUnit/Extensions/PhptTestCase.php';
$|  //$currentErrorReporting should be proposed here
Comment 1 Zhongwei Zhao CLA 2012-09-24 00:57:27 EDT
Created attachment 221393 [details]
patch
Comment 2 Zhongwei Zhao CLA 2012-09-24 00:57:49 EDT
Created attachment 221394 [details]
patch
Comment 3 Zhongwei Zhao CLA 2012-09-24 01:05:01 EDT
move to DLTK,the patch is to get the right container path for php include path(build path).
Comment 4 Zhongwei Zhao CLA 2012-09-24 01:05:41 EDT
Add Natalia to CC
Comment 5 Alex Panchenko CLA 2012-09-24 01:20:30 EDT
@Zhao both patches are needed, right?
Comment 6 Zhongwei Zhao CLA 2012-09-24 01:25:59 EDT
Hi Alex,
Yes,both are needed,thanks!
Comment 7 Natalia Bartol CLA 2012-10-18 14:34:09 EDT
Created attachment 222536 [details]
Fixed patch

The patch for org.eclispe.dltk.core wouldn't work for Mac and Linux systems. Fixed patch attached.
Comment 8 Natalia Bartol CLA 2012-11-15 04:21:43 EST
Alex, any plans on committing those patches?
Comment 9 Alex Panchenko CLA 2012-11-15 06:47:35 EST
Natalia, how can I reproduce this?
I have DLTK & PDT checked out.

How should I add phpunit? Is phpunit.phar supported? or do I need it as sources?
Comment 10 Natalia Bartol CLA 2012-11-15 08:43:20 EST
Add PHPUnit sources to include path of your php project. It doesn't work for phar.
Comment 11 Alex Panchenko CLA 2012-11-15 13:03:03 EST
Natalia, Zhao, surprisingly it works for me without this patch.
Linux, DLTK & PDT from git master.
I installed phpunit using composer/required-dev http://www.phpunit.de/manual/current/en/installation.html#installation.composer , so it was unpacked to vendor/phpunit/phpunit

then I tried 2 ways:
a) require_once 'vendor/phpunit/phpunit/PHPUnit/Extensions/PhptTestCase.php'
b) add vendor/phpunit/phpunit to php include path and require_once 'PHPUnit/Extensions/PhptTestCase.php'
In both cases $currentErrorReporting completion proposal was available.

Could you, perhaps, provide more details on how to reproduce the bug?
Comment 12 Alex Panchenko CLA 2012-11-15 13:10:49 EST
Is it windows specific?
Comment 13 Natalia Bartol CLA 2012-11-15 14:07:00 EST
The case is you don't have the PHPUnit in your project. Not even in your workspace. 

Have your PHPUnit sources anywhere on your disk, just not in the project. Configure the include path of your project -> Libraries -> Add External Source folder -> pick your PHPUnit.
Comment 14 Natalia Bartol CLA 2012-11-15 14:08:03 EST
And it is not platform specific.
Comment 15 Alex Panchenko CLA 2012-11-15 23:04:16 EST
Natalia, now it doesn't work even with the patches.

in org.eclipse.php.internal.core.filenetwork.FileNetworkUtility.findSourceModule(ISourceModule, String, Set<String>) line 323 projectFragments is null.

for me that folder is handled as BPE_LIBRARY, but IncludedFileResult.setProjectFragments(IProjectFragment[]) is called only from the BPE_CONTAINER branch.
Comment 16 Natalia Bartol CLA 2012-11-16 05:13:36 EST
Alex, my bad, I gave you wrong example.

The correct flow is:
Configure Include Path -> Libraries -> Add Library -> User Library -> Configure -> New -> set name -> Add External Folder (your PHPUnit sources) -> Finish.

The one that you tested: Include Path -> Libraries -> Add External Source is not fixed yet.
Comment 18 Natalia Bartol CLA 2012-11-29 06:53:59 EST
Thanks Alex, are there nightly builds of DLTK available somewhere?