| View previous topic :: View next topic |
| Author |
Message |
Richie
Joined: 06 Jun 2009 Posts: 3
|
Posted: Sat Jun 06, 2009 5:12 pm Post subject: flawed code completion?? Joomla 1.5 |
|
|
Hi Guys,
well first of all i just want to say that netbeans is brilliant - I've tried lots of different editors for the mac and most of them suck!
however i do have a slight issue with netbeans, something that was in my old windows based IDE that i miss.
there seems to be a flaw in code completion, take for instance the following example.
| Code: | | $mainframe =& JFactory::getApplication('site'); |
now inside $mainframe we have a good many methods to work with
| Code: |
$mainframe->initialise();
$mainframe->triggerEvent();
$mainframe->route();
$mainframe->render();
|
amongst others, however netbeans seems to completely ignore the fact that $mainframe contains these
if i type
and hit cmd + \
it successfully completes the code for me $mainframe
however if i then append -> on the end and hit cmd + \
it tells me it has no suggestions, when clearly there should be?
this could of course not be flawed, and i could be missing some rather obvious check box i need to tick
can anyone help?
Thanks in Advance |
|
| Back to top |
|
 |
Peter Ford Posted via mailing list.
|
Posted: Mon Jun 08, 2009 8:00 am Post subject: flawed code completion?? Joomla 1.5 |
|
|
Richie wrote:
| Quote: | Hi Guys,
well first of all i just want to say that netbeans is brilliant - I've tried lots of different editors for the mac and most of them suck!
however i do have a slight issue with netbeans, something that was in my old windows based IDE that i miss.
there seems to be a flaw in code completion, take for instance the following example.
Code:
$mainframe =& JFactory::getApplication('site');
now inside $mainframe we have a good many options to work with
Code:
$mainframe->initialise();
$mainframe->triggerEvent();
$mainframe->route();
$mainframe->render();
amongst others, however netbeans seems to completely ignore the fact that $mainframe contains these
if i type
Code:
$main
and hit cmd + \
it successfully completes the code for me $mainframe
however if i then append -> on the end and hit cmd + \
it tells me it has no suggestions, when clearly there should be?
this could of course not be flawed, and i could be missing some rather obvious check box i need to tick
can anyone help?
Thanks in Advance
|
Remember that PHP is not a strongly-type like (like Java is) and so it's not
always clear what the type of a variable is.
There are a few tricks that Netbeans uses to work around this - I don't have the
reference to hand that explains them, but using Doc-Comments for method
parameters and member variables helps. I guess your factory pattern prevents you
from using
$mainframe = new Application('site')
or whatever - that would also let NetBeans work out what type $mainframe is.
Even with these suggestions there are still holes in NetBeans ability to guess
the type of an object - it doesn't do very well at suggestion methods from
superclasses, for example...
I suspect an enhancement request already exists for this - I might look it up an
vote for it.
--
Peter Ford, Developer phone: 01580 893333 fax: 01580 893399
Justcroft International Ltd. www.justcroft.com
Justcroft House, High Street, Staplehurst, Kent TN12 0AH United Kingdom
Registered in England and Wales: 2297906
Registered office: Stag Gates House, 63/64 The Avenue, Southampton SO17 1XS |
|
| Back to top |
|
 |
Tomas Mysik Posted via mailing list.
|
|
| Back to top |
|
 |
Richie
Joined: 06 Jun 2009 Posts: 3
|
Posted: Mon Jun 08, 2009 8:41 am Post subject: |
|
|
Hi guys,
Much appreciate the replies.
Don't think I much fancy commenting the entire Joomla! Core.
However it's not that much of an issue. It's not as if I don't know them, I'm just really lazy.
It's still the best IDE I've tried. Couldn't get code completion to work at all.
Does net beans code completion support code snippets? I could add my commonly used ones there if it does (I'll take a look when I get home)
If not Ill manage
Thanks
Richie |
|
| Back to top |
|
 |
Tomas Mysik Posted via mailing list.
|
Posted: Tue Jun 09, 2009 3:37 pm Post subject: flawed code completion?? Joomla 1.5 |
|
|
Hi,
Dne pondělí 08 června 2009 10:41:34 Richie napsal(a):
| Quote: | Much appreciate the replies.
|
you are welcome.
| Quote: | Don't think I much fancy commenting the entire Joomla! Core.
|
Maybe you can submit a bug against Joomla ;)
| Quote: | However it's not that much of an issue. It's not as if I don't know them,
I'm just really lazy.
|
Here, CTRL + k could help (complete word - it's not code completion!).
| Quote: | It's still the best IDE I've tried. Couldn't get code completion to work at
all.
|
So, if you create a new PHP project and add 2 PHP classes - you don't have
them in code completion (invoked by CTRL + space)? If so, please try to use
the latest NetBeans version possible (currectly NB 6.7 RC) or a clean userdir
[1]. Please, file a new issue [2] if nothing helps.
| Quote: | Does net beans code completion support code snippets? I could add my
commonly used ones there if it does (I'll take a look when I get home)
|
Yes, you can find them (and add new ones) in Tools > Options > Editor > Code
Templates (then choose PHP).
HTH,
Tomas
[1] http://wiki.netbeans.org/FaqAlternateUserdir
[2] http://www.netbeans.org/community/issues
--
Tomas Mysik
address-removed |
|
| Back to top |
|
 |
zehdeh
Joined: 25 Aug 2009 Posts: 1
|
Posted: Tue Aug 25, 2009 7:17 pm Post subject: |
|
|
is there a way to tell netbeans (like with macros or even a plugin) this:
| Code: |
myClass = Factory::Create("myClass");
// equal to
myClass = new myClass();
|
At work we have to use factory patterns quite often and code completion would be very nice to have. |
|
| Back to top |
|
 |
Tomas Mysik Posted via mailing list.
|
|
| Back to top |
|
 |
radek matous Posted via mailing list.
|
Posted: Wed Aug 26, 2009 12:55 pm Post subject: flawed code completion?? Joomla 1.5 |
|
|
Tomas Mysik wrote:
or if Factory is part of your project:
class Factory {
/**
* @return MyClass
*/
static function Create($name) {
}
}
Radek |
|
| Back to top |
|
 |
|