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
Sublime text 3 php code completion problem
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:
{
"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.
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.