Aptana Studio 3 code completion / assist not working for Yii Framework

8.7k views Asked by At

I just started development with Aptana Studio 3 and Yiiframework. Since Aptana Studio 3 already supports code completion for PHP and Yiiframework does faciliate correct use of PHPDoc comments and return types, I assumed that calling

$app = Yii::app();
$app->...

should pop up content assist with methods and fields of the CApplication class. But I only see an empty popup window containing 'No proposal'. The same happens when accessing the application object directly using

Yii::app()-> // empty code assist window

When I declare the type of the $app variable explicitly, code assist pops up correct:

/**
 * @var CApplication
 */
$app = Yii::app();
$app-> // code assist pops up with correct content

I don't have included yiilite.php - this file is stripped from my framework directory. Code assist works, but not as expected.

Is this a bug, or a missing feature? Can anybody else confirm this behaviour of Aptana Studio 3? Is there any workaround?

Thanks, David

7

There are 7 answers

0
liliumdev On

Follow the steps given here and the code completion should work properly.

0
Firas Abd Alrahman On

http://firas-vision.com/aptana-yii-2/

please check this solution worked for me , no new plugin , it is just a code fix for com.aptana.editor.php.jar plugin

I pulled a request to change on Aptana git , hope they will include this fix in the next release

0
Afser2000 On

The other methods mentioned here will not work for YII code assist.

See if this helps:

  1. Start with a PHP Project (Or for an existing project: Configure -> Add PHP support )
  2. Add the YII framework to the build path like below.

PHP Include path -> Libraries -> Add External source folder -> Select the 'framework' folder from the YII framework unzipped

Also point #5 from Arek about adding the Eclipse PHP nature helped me too. Thanks

0
chitwarnold On
0
chitwarnold On
  1. unzip your yii source tarbal, import the framework directory as a project on your workspace
  2. Navigate to Your project Explorer, and right click on the project you wish to support Yii's autocomplete on and select "Properties"
  3. A project properties' dialog page will be displayed, on the right side of the dialog there is a tree select the child labelled "PHP Buildpath", on your right click on "Add" and add the "Framework Directory " as part of your build path
  4. Apply Changes and Press OK to submit the changes. Now try to create a class that extends any of the Yii Core Classes it should autocomplete successfully.

Enjoy Yourself

0
Arek - Krakiewicz.pl On

I don't know how exactly I did this, but:

  1. Delete already existing project.
  2. Install PDT plugin for Aptana by "Help->Install New Software"
  3. Restart Aptana Studio
  4. Create again new project and check out in project properties You have new "Nature" called "org.eclipse.php.core.PHPNature" as a primary.
  5. Uncheck "PHP" Nature, only "org.eclipse..." should be checked.

Only with this nature I see all classes, methods etc...
With orginial aptana's "PHP" Nature it was impossible.

"org.eclipse.php.core.PHPNature" is solution for this.

EDIT: PDT might not be required for Aptana since it has PHP support built-in

0
Ametad On

It is also important to explicitly set the 'Project Nature' to (include) PHP. Project->properties->Project Natures