Home Download Buy Blog Forum Support

PHP inline function reference

PHP inline function reference

Postby tylernz on Sat Jun 23, 2012 2:58 am

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!
tylernz
 
Posts: 2
Joined: Sat Jun 23, 2012 2:55 am

Re: PHP inline function reference

Postby agibsonsw on Sat Jun 23, 2012 2:32 pm

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 8-)
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: PHP inline function reference

Postby tylernz on Sat Jun 23, 2012 3:04 pm

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:

Code: Select all
<?php strpos(
- hit the keyboard shortcut would show:
Code: Select all
int strpos ( string $haystack , mixed $needle [, int $offset = 0 ] )
tylernz
 
Posts: 2
Joined: Sat Jun 23, 2012 2:55 am

Re: PHP inline function reference

Postby agibsonsw on Sat Jun 23, 2012 3:20 pm

@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:

Code: Select all
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.

[I had considered creating a system such that information about parameters would appear in the status-bar as we typed, but I think parameters are not generally well, or reliably, documented enough to make this worthwhile.]
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 11 guests