8

I am using Eclipse PDT to code with PHP Code Igniter. I would like to get auto complete working. Anyone know how I can accomplish this? I've found a few online tutorials but had no success.

Cœur
  • 37,241
  • 25
  • 195
  • 267
user1797484
  • 758
  • 3
  • 10
  • 20

3 Answers3

16

You could try this method

  1. Choose “Project” -> “Properties” or “Window” -> “Preferences” -> “PHP” (for global usage)
  2. Choose “PHP Include Path”
  3. Click on “Add External Source Folder” and point to file below
  4. restart eclipse

Point path to this file below

ciautocomplete.php

<?php

/**
* @property CI_DB_active_record $db
* @property CI_DB_forge $dbforge
* @property CI_Benchmark $benchmark
* @property CI_Calendar $calendar
* @property CI_Cart $cart
* @property CI_Config $config
* @property CI_Controller $controller
* @property CI_Email $email
* @property CI_Encrypt $encrypt
* @property CI_Exceptions $exceptions
* @property CI_Form_validation $form_validation
* @property CI_Ftp $ftp
* @property CI_Hooks $hooks
* @property CI_Image_lib $image_lib
* @property CI_Input $input
* @property CI_Language $language
* @property CI_Loader $load
* @property CI_Log $log
* @property CI_Model $model
* @property CI_Output $output
* @property CI_Pagination $pagination
* @property CI_Parser $parser
* @property CI_Profiler $profiler
* @property CI_Router $router
* @property CI_Session $session
* @property CI_Sha1 $sha1
* @property CI_Table $table
* @property CI_Trackback $trackback
* @property CI_Typography $typography
* @property CI_Unit_test $unit_test
* @property CI_Upload $upload
* @property CI_URI $uri
* @property CI_User_agent $user_agent
* @property CI_Validation $validation
* @property CI_Xmlrpc $xmlrpc
* @property CI_Xmlrpcs $xmlrpcs
* @property CI_Zip $zip
*/

class CI_Controller {};
class MY_Controller {};
/**
* @property CI_DB_active_record $db
* @property CI_DB_forge $dbforge
* @property CI_Config $config
* @property CI_Loader $load
* @property CI_Session $session
*/

class CI_Model {};
Philip
  • 4,592
  • 2
  • 20
  • 28
  • Superb answer. One thing to add, In similar ways we can add our model classes to the auto complete from controllers. – Jeyasithar Oct 30 '13 at 13:57
  • Absolutely no idea how it works, but it worked for me. Also trying to add Ion_auth library but never succeeded. – David Okwii Jun 16 '17 at 17:16
  • 1
    To anyone seeing this answer now, it still works, but some changes need to be done as codeigniter changed. – Spoody Dec 31 '17 at 16:14
3

For Eclipse PDT: Make in root CodeIgniter ciautocomplete.php end paste code above(1 answer). This is it. You will happy, how it's work :-)

vlad
  • 313
  • 3
  • 9
0

Autocomplete of your own model in your controllers:

$this->load->model('my_model');

$this->my_model = new My_model();

....

typing: $this->my_model-> 

Eclipse autocomplete with the model's attributes and methods

Dijkgraaf
  • 11,049
  • 17
  • 42
  • 54