Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 335978 - Smarter code assist on function and method calls
Summary: Smarter code assist on function and method calls
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: PHP Core CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-01 10:50 EST by Mauro Molinari CLA
Modified: 2020-05-14 10:17 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mauro Molinari CLA 2011-02-01 10:50:21 EST
When you are writing a function or method call and you invoke code assist (while the cursor is before, after or between parameters), instead of suggesting the parameters to pass to the function or method, the PHP editor shows non-contextual proposals (that is: every variable or function I may refer to).

For instance, consider the following cases:

// note: "|" means "invoke code assist here"

str_pad(|);
str_pad($a, |);
str_pad($a, $b|);

$dt = new DateTime();
$dt->setDate(|);
$dt->setDate($a, |);
$dt->setDate($a, $b, $c|);

In all of these cases I would expect that invoking code assist at the "|" locations would suggest the function/method signature, so that I know what parameters I have to (or I can) specify. In the previous examples:

str_pad(|); => brings a tooltip with: "$input, $pad_length, $pad_string, $pad_type" ($input in bold)

$dt->setDate($a, |) => brings a tooltip with "$year, $month, $day" ($month in bold)

Instead, I have generic proposals on WHAT I may pass to the function. IMHO this kind of proposals are useful only as soon as I have typed at least one character of the parameter. For instance:

$myFormat = 'Ymd';
$dt = new DateTime();
$dt->format(|);   // case a)
$dt->format($m|); // case b)

In case a), I expect the editor to suggest the method signature, i.e. a tooltip that tells me there's an only parameter called $format (in bold) I can specify.
In case b), instead, I expect the editor to suggest the completion for $myFormat variable name (like it does right now).

If you have a look to the JDT Java editor, it works like this and it's much more comfortable. Right now with the PHP editor, if you don't remember a method/function signature and you want to change/write a method/function call, you have to either hit F2 on the method/function name (to see the phpdoc) or go to its declaration, because you can't simply put the cursor on the method/function call and invoke code assist to see what parameters it takes.