FeaturesPluginsDocs & SupportCommunityPartners

NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

flawed code completion?? Joomla 1.5

 
Post new topic   Reply to topic    NetBeans Forums -> PHP Users
View previous topic :: View next topic  
Author Message
Richie



Joined: 06 Jun 2009
Posts: 3

PostPosted: Sat Jun 06, 2009 5:12 pm    Post subject: flawed code completion?? Joomla 1.5 Reply with 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 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

Code:
$main


and hit cmd + \
it successfully completes the code for me $mainframe

however if i then append -> on the end and hit cmd + \

Code:
$mainframe->


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
View user's profile Send private message
Peter Ford
Posted via mailing list.





PostPosted: Mon Jun 08, 2009 8:00 am    Post subject: flawed code completion?? Joomla 1.5 Reply with quote

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.





PostPosted: Mon Jun 08, 2009 8:12 am    Post subject: flawed code completion?? Joomla 1.5 Reply with quote

Hi,

Dne sobota 06 června 2009 19:12:41 Richie napsal(a):
Quote:
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!

thanks a lot for your positive feedback!

Quote:
Code:
$mainframe =& JFactory::getApplication('site');

2 possibilities here:
1. Add PHPDoc comment [1] to the JFactory::getApplication method, or
2. Use "vdoc" template [2]

Option 1 is preferred, of course. If any of these options does not work for
you, please, repor a bug [3].

HTH,
Tomas
[1] http://www.phpdoc.org/,
http://manual.phpdoc.org/HTMLSmartyConverter/PHP/phpDocumentor/tutorial_tags.return.pkg.html
[2] http://blogs.sun.com/netbeansphp/entry/defining_variable_type_in_a and
http://blogs.sun.com/netbeansphp/entry/defining_a_variable_type_in
[3] http://www.netbeans.org/community/issues
--
Tomas Mysik
address-removed
Back to top
Richie



Joined: 06 Jun 2009
Posts: 3

PostPosted: Mon Jun 08, 2009 8:41 am    Post subject: Reply with quote

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
View user's profile Send private message
Tomas Mysik
Posted via mailing list.





PostPosted: Tue Jun 09, 2009 3:37 pm    Post subject: flawed code completion?? Joomla 1.5 Reply with quote

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

PostPosted: Tue Aug 25, 2009 7:17 pm    Post subject: Reply with quote

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
View user's profile Send private message
Tomas Mysik
Posted via mailing list.





PostPosted: Wed Aug 26, 2009 11:58 am    Post subject: flawed code completion?? Joomla 1.5 Reply with quote

Hi,

Dne úterý 25 srpna 2009 21:17:28 zehdeh napsal(a):
Quote:
is there a way to tell netbeans (like with macros or even a plugin) this:
Code:
myClass = Factory::Create("myClass");

you likely want to use "vdoc" template. More information on our blog [1] [2].

Tomas
[1] http://blogs.sun.com/netbeansphp/entry/defining_variable_type_in_a
[2] http://blogs.sun.com/netbeansphp/entry/defining_a_variable_type_in
--
Tomas Mysik
address-removed
Back to top
radek matous
Posted via mailing list.





PostPosted: Wed Aug 26, 2009 12:55 pm    Post subject: flawed code completion?? Joomla 1.5 Reply with quote

Tomas Mysik wrote:
Quote:
Hi,

Dne úterý 25 srpna 2009 21:17:28 zehdeh napsal(a):

Quote:
is there a way to tell netbeans (like with macros or even a plugin) this:
Code:
myClass = Factory::Create("myClass");


you likely want to use "vdoc" template. More information on our blog [1] [2].

Tomas
[1] http://blogs.sun.com/netbeansphp/entry/defining_variable_type_in_a
[2] http://blogs.sun.com/netbeansphp/entry/defining_a_variable_type_in

or if Factory is part of your project:

class Factory {
/**
* @return MyClass
*/
static function Create($name) {
}
}

Radek
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> PHP Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB