Home Download Buy Blog Forum Support

sublime text 3 php code completion problem

sublime text 3 php code completion problem

Postby markkenzy on Sun Jun 16, 2013 7:16 am

Hi, I just recently switch from notepad++ to sublime text 3. I love everything of sublime except the code suggest does not work well with php. Some simple functions works well like in_array(needle, haystack), similar_text(first, second). Nice snipped ! But lots of other are just missing for ex: when typing "mysqli_stmt", I expect that sublime will provide me with mysqli_stmt_bind_param, mysqli_stmt_exercuse, ect. I think the function is recognized (because it turned blue), but somehow it does not show in the suggestion window. Do I need to install any extra packages for this to work ? Thanks
markkenzy
 
Posts: 2
Joined: Sun Jun 16, 2013 7:05 am

Re: sublime text 3 php code completion problem

Postby Lemon on Sun Jun 16, 2013 8:58 am

This is just because the functions you want aren't included in the PHP.sublime-completions file.

To see a list of all of the PHP auto completions that are available just open the "/Packages/PHP.sublime-package" file in the Sublime Text 3 install directory by using something like 7zip or WinRAR or whatever you want.
Then open the "PHP.sublime-completions" file.

To add additional completions open the "/Data/Packages/User" directory (you can easily get to it by using ctrl + shift + p in Sublime and typing "browse", then selecting the "Browse Packages" option).

Once you are in this directory you can create your own PHP.sublime-completions file (really you can name it anything you want).
Once created you can put whatever completions you want in there.

For example to start with you can paste in:

Code: Select all
{
   "scope": "source.php - variable.other.php",

   "completions":
   [
      "php",

      { "trigger": "mysqli_stmt_bind_param", "contents": "mysqli_stmt_bind_param(${1:stmt}, ${2:types}, ${3:var_1})" },
      { "trigger": "mysqli_stmt_execute", "contents": "mysqli_stmt_execute(${1:stmt})" }
   ]
}


As soon as you save the file you should see "mysqli_stmt_bind_param" and "mysqli_stmt_execute" in the auto-completions popup menu.
Lemon
 
Posts: 27
Joined: Wed Jul 11, 2012 12:49 pm

Re: sublime text 3 php code completion problem

Postby markkenzy on Sun Jun 16, 2013 3:22 pm

Thanks a lots. I thought sublime gonna provide me full list of php function. I guess I have to install extra package (like code intel) for better code completion.
markkenzy
 
Posts: 2
Joined: Sun Jun 16, 2013 7:05 am

Re: sublime text 3 php code completion problem

Postby Fed03 on Mon Jun 17, 2013 12:34 am

look for andyphp package.....it provides a complete sublime completions file for php!!!
Fed03
 
Posts: 79
Joined: Sun Oct 16, 2011 6:38 pm


Return to General Discussion

Who is online

Users browsing this forum: Yahoo [Bot] and 30 guests