Sublime Forum

PHP inline function reference

#1

Hi, I’ve been searching for a bit now and can’t seem to find the answer to:

How do I get ST2 to show the parameters to a standard php function? For example if I typed: strpos( then hit opt + f1 in textmate, it would tooltip the parameters for that PHP function. I’m sure ST2 has it, I’m just missing something …

Thanks for your help!

0 Likes

Autocomplete parameters of created functions
#2

ST comes with a PHP completions file and snippets pre-installed. They should display automatically as long as your current syntax is for PHP. Alternatively, try pressing Tab or Ctrl-Space to initiate them.

Otherwise, these files may be missing or corrupted; your settings may have been changed to prevent the completions from appearing or, possibly, some other plugin is disabling them.

Try pressing Ctrl ’ (apostrophe) to see if there is any error message in the Console. You could also try disabling some of your plugins, or perhaps even a fresh install.

Alternatively, download my recent PHP completions file from here. You can save it (and/or rename it) in either your User or PHP folder within \Packages. Mine is a much more up-to-date version anyway :sunglasses:

0 Likes

#3

Hey agibsonsw - thanks, yeh, auto-complete works – I’m not sure if you’re fimilar with TextMate and what Opt+F1 does … when you’re in a PHP function and you hit those keys, it produces a tooltip with the definition of that function, the parameters accepted and what those parameters should be.

So for example:

<?php strpos( [/code] - hit the keyboard shortcut would show: [code]int strpos ( string $haystack , mixed $needle , int $offset = 0 ] )
0 Likes

#4

@tylernz. I’m not familiar with TextMate, although I am with other IDEs.

Unlike other IDEs, ST cannot produce a tooltip, or prompt box - the nearest we have is what appears in the completions list. I could have included 'string ’ etc. in my completions file but decided against it. Besides, the list isn’t wide enough to show all this information. My strpos completion appears like this:

strpos(haystack, needle, offset])

There are help systems available via PackageControl that can jump to, or display, help on a key-combination. I’ve even created two myself - one just recently in another thread, which opens a .chm file at the relevant page. Some help systems will display the help in a panel at the bottom of the view, whereas other systems will search the web.

**

0 Likes