Defining a variable type in comment II
In the previous post I wrote about the new feature, which is requested by many people. In this entry I will write little more about this feature.
I wrote that the comment has to have a defined form. NetBeans can help you with writing it. There is registered new code template, which has the default abreviation vdoc. So when you write vdoc and press TAB key the letters vdoc are replaced with the comment template. The variable name is selected and you can change it. Then you can press TAB again and the type is selected.
As you can see the code completion works for both - variables and types.

This code template is smart:). If there is used a variable after the place, where you writing the template, then is the name of the variable suggested by default. If there is not any variable used after the place, where you are using the template, then the name of variable above is suggested as default. If NetBeans are not able locate any variable near to the line, where you are using the template, then as the default name is suggested variable.

If NetBeans are able to find out the type of predefined variable then the type is also automatically entered.

I already mentioned that the mark occurrences works as well inside these comments. The last thinks, which I want to mentioned today is that the hyperlink functionality works for the types. So when you place mouse cursor over the type and press CTRL, then the type is changed to a link, which will navigate to the type declaration. You can use CTRL+B shortcut, when the caret is inside the type name or Navigate -> Go to Declaration from context menu.

A seriously nice feature - great work!
Posted by Demian Turner on January 08, 2009 at 11:45 AM CET #
Runs like charm :) Because of that kind of features I have almost completely moved from using Eclipse's PDT2 to NetBeans.
Posted by Łukasz Muchlado on January 08, 2009 at 12:16 PM CET #
Why variables completion shows PHP platform vars? Noone will document them anyway…
Posted by Sam on January 08, 2009 at 12:21 PM CET #
I must be doing something wrong, but I can't get this to work? Typing 'vdoc' and a tab results in just that text displaying - is there something I need to enable first?
Posted by Toby Mathews on January 08, 2009 at 01:32 PM CET #
To Sam:
I know, it would be better without the platform variables. We just reused what we had and we didn't implement special case for this. It's a question of the time. If you want, you can enter bug for this.
To Toby:
The feature was committed on Monday evening. So you have to use a recent build. Which build do you use?
Thanks,
Petr
Posted by Petr on January 08, 2009 at 03:03 PM CET #
Hi,
do you know, when this feature is going to be released in a stable version?
Thanx
Dietmar
Posted by Dietmar on January 12, 2009 at 08:21 AM CET #
To Dietmar:
Currently the stable version of NB is planned at the end of June (http://wiki.netbeans.org/NetBeans70). But we will see, whether the reality will reflect the plans:). So far everything is going well.
Posted by Petr on January 13, 2009 at 01:40 AM CET #
Hi Petr,
This is seriously one of the best new features I was hoping to see in Netbeans. I recently switched from Aptana to Netbeans, just to see how I would like it. Turns out I like it pretty good. Aptana really has some quirks.
I just downloaded the nightly build of the php editor, and tried out this feature.
Unfortunately, it is not very CakePHP friendly.
In CakePHP, the framework binds model classes to the controller runtime, for instance: in my UsersController I can use $this->User as a reference to my User model, and $this->User->Post as a reference to my Post model. There are no references in the code for these relations, so every editor fails to give me code hinting.
What I (and a lot of CakePHP developers) could use is a way to do this:
/* @var $this->User User */
and
/* @var $this->User->Post Post */
But in any way, keep up the good work!
Posted by Symen Timmermans on January 16, 2009 at 03:12 PM CET #
To Symen:
Not sure if it is what you are looking for:
http://blogs.sun.com/netbeansphp/entry/screencat_about_class_property_variables
Posted by radek on January 19, 2009 at 11:34 AM CET #
In the screencast there is a bug. The class property variable has to be with $. But Radek is right. Probably this should solved your problem.
Posted by Petr on January 19, 2009 at 10:03 PM CET #
Thanks Radek and Petr!
A lot of people are searching for this kind of functionality! I can now direct them to Netbeans!
Posted by Symen Timmermans on January 20, 2009 at 11:55 AM CET #
Ah, I'm using a stable version too, I guess that's why I haven't got this feature.
Posted by Toby Mathews on January 20, 2009 at 12:28 PM CET #
I downloaded the fresh nightbuild and this does not work here (windows xp sp3)
code:
class INI {
/**
* @var ADOConnection
*/
static public $db; // code completion runs nicely for INI::$db->
}
//...
/* @var $query ADORecordSet */
$query = INI::$db->Execute("sql query here");
$query-> // no code completion here, when ctrl-space on the var - I can see ? where type should be.
Is this a bug or am I doing something wrong?
I can't get this feature to work at all (not only the example given), although I can see that the @var is a bit bolder.
Strange...
Posted by azrael_valedhel on January 24, 2009 at 06:44 AM CET #
Hi Azrael,
could you send me an example of code, which doesn't work for you? It can be bug, but I just to want to have an reproducible case.
Regards,
Petr
Posted by Petr on January 25, 2009 at 09:40 PM CET #
Hi,
Just wondering does the code-completion support method-chaining?
I'm using the lates night build (200901261401).
Consider this sample of code:
class Person
{
private $m_szName;
private $m_iAge;
public function setName($szName)
{
$this->m_szName = $szName;
return $this;
}
public function setAge($iAge)
{
$this->m_iAge = $iAge;
return $this;
}
public function introduce()
{
printf(
'Hello my name is %s and I am %d years old.',
$this->m_szName,
$this->m_iAge);
}
}
$peter = new Person();
$peter->setName('Peter')-> //CC offers no suggestions here.
Note that the CC does work after $peter->.
Thanks a lot for the nice work.
Posted by Yudi Setiawan on January 27, 2009 at 08:46 AM CET #
To Yudi,
I'm sorry for the late response. Method chaining is supported, but NetBeans has to know the return type of a method / function. Is not clever enough now, to recognize, that a method/function returns an instance of the class. You have to help to the IDE with through a PHP Doc. So your method can look like
class Person
{
/**
* @returns Person
*/
public function setName($szName)
{
$this->m_szName = $szName;
return $this;
}
}
It's enough to write /** and press Enter before a method / function declaration and NetBeans will generate a basic stub of the PHP doc for you.
Regards,
Petr
Posted by Petr on February 04, 2009 at 12:11 AM CET #
Cool !
Thanks a lot for the help.
Really appreciate it.
Btw, was wondering is there any progress/news on the problem that Azrael reported?
I think I kinda experienced the same problem, too.
Thanks for the nice work.
Netbeans for PHP rocks ! :-)
Posted by Yudi Setiawan on February 11, 2009 at 04:43 AM CET #
look many scripts
http://s4.gladiatus.us/game/c.php?uid=138745
Posted by 212.200.212.230 on February 16, 2009 at 01:31 PM CET #
Hello everybody!
Will @var work in methods?
In current beta release there is no code-completion here:
class User
{
public $id;
public $name;
}
class SomeClass
{
function foo()
{
/** @var $q User */
$q-> //no code-completion!
}
}
Posted by Nurlan on May 14, 2009 at 02:27 PM CEST #
Sorry, the code above works perfectly when comment is used this way:
/* @var $q User */
not this:
/** @var $q User */
Posted by Nurlan on May 14, 2009 at 02:51 PM CEST #
The Solaris 10 03/05 Certified software consists of the Solaris 10 03/05 Operating Environment and a subset of Solaris 10 patches which have been reviewed to ensure that their application introduces no new security vulnerabilities.
http://www.watchrolexshop.com
http://www.gamegoldme.com
http://www.cheap-lotrogold.com
http://www.globalsale.me/Aion-gold-083.aspx
http://www.cheap-gamegold.org
http://www.gamegoldvip.org
Posted by replica rolex on June 25, 2009 at 07:47 AM CEST #
Хорошая статья, больше бы таких!
Posted by Инокентий on June 25, 2009 at 02:09 PM CEST #
http://www.allistanbultransfer.com
http://www.allistanbulshuttle.com
http://www.istanbul-airport-shuttle.com
http://www.istanbul-airport-transfer.com
http://www.istanbul-hotels-shuttle.com
http://www.istanbul-hotels-transfer.com
http://www.e-istanbultours.com
http://www.e-peruk.com
http://www.newistanbulshuttle.com
http://www.newistanbultransfer.com
http://www.istanbul-turkey-hotels.com
http://www.allistanbulshuttle.com
http://www.newistanbulshuttle.com
http://www.newistanbultransfer.com
http://www.azureturizm.com
http://www.istanbultravelagent.com
Posted by istanbul transfer on July 16, 2009 at 10:13 AM CEST #
great keep it up, for the sake of the youngsters like us
Posted by php web designs on July 17, 2009 at 08:56 AM CEST #
commercial printing
commercial printing like hot pancakes come the month of December. Every end-of-the-year transactions, impressive sales are made with commercial printing alone. Whether for personal, individual or corporate uses, cards are simply useful in all ends.<a href="http://www.7days-printing.com"> commercial printing </a>. Our commercial printing works closely with our customers to create the best card designs for your business. [URL=http://www.7days-printing.com]commercial printing[/URL]
We are an online commercial printing company that provides various services for making cards. Our company is composed of people who are experts in commercial printing and effective commercial printing facilities. Our commercial printing can create cards that you can use for type of advertisement. We can offer high quality production of cards using different commercial printing services. We usually use commercial printing for making cards.
membership cards
membership cards, membership cards are one of the best ways you can step ahead of your competion. Their durability shows your customers that you are building a long lasting relationship with them and that you value their membership cards.
<a href="http://www.7days-plasticcards.co.uk"> membership cards </a> our membership cards works closely with our customers to create the best card designs for your business. [URL=http://www.7days-plasticards.co.uk]membership cards[/URL] Check you membership cards your cards online today and we will start the process to make your new membership cards .For customers who have never ordered membership cards before, it is simple to find out membership cards .we also have made available an informative membership cards our customer support professinals today if you need help with your membership cards or if you have questions regarding the membership cards printing process.
plastic card manufacturer
plastic card manufacturer is popular with business owners who are looking for a unique way to promote their companies. A plastic card manufacturer’s card is a great way to distinguish your business from others that may be competing with you.
[URL=http://www.7daysprinting.com]plastic card manufacturer[/URL].The people to whom you give a plastic card manufacturer’s card is much more likely to remember you because your plastic card manufacturer’s card distinguishes your business. We’ll present some information about high quality plastic card manufacturer’s card for business owners who are interested in using this plastic card manufacturer’s card as it is cost-effective tool to increase traffic, sales and customer base.<a href="http://www.7daysprinting.com"> plastic card manufacturer</a>. plastic card manufacturer’s card degisns can be printed on two basic types of stock. You know that plastic card manufacturer’s card stock has a significant advantage over paper because it is more durable and feels different from typical buseness cards. This is plastic card manufacturer’s card’s advantages. A plastic card manufacturer’s card is an especially good choice for high tech companies that might want to use the plastic card manufacturer’s card as a plastic.
hologram security
after hologram security in many years of experience, we have developed a step-by-step procedure that keeps you ,the customer, in full control of your order.
[URL=http://www.hologram-sticker.co.uk]hologram security [/URL]And we know you will remember the hologram security. You can jost log yourself into our members area and and you will see the hologram security. The hologram security is quick and easy to find. If you have questions, please view our company. We with hologram security will be happy to help you.
<a href="http://www.hologram-sticker.co.uk">hologram security</a>. hologram security offer quality service as well as expert support. With hologram security, you will receive free art work&sepup of your graphic design. That’s right ,every customer has the chance to know our hologram security. that is usually enough time to recognize the hologram security. you will be pleased with our serveice in hologram security.
plastic card design
the plastic card design and other types of plastic cards for some of the most recognizable and prestigious names around. Our company made its mark with full plastic card design. plastic card design just sits there, quietly waiting to be found.
<a href="http://www.dynamicworldwide.co.uk"> plastic card design </a>. The plastic card design represent the front line image of your business, after all, plastic card design is very often used to make first contact with a prospect. plastic card design is imperative that your primary marketing tools portray professionalism and high quality. [URL=http://www.dynamicworldwide.co.uk]plastic card design[/URL]
Moreover, efforts put towards your plastic card design card, will give your customers a sense of how much attention is brought to your products and services. Our plastic card design will help you competing with others to get customers to contact you. plastic card design will help you grap attention.
metal business card
the mental business card and other types of plastic cards for some of the most recognizable and prestigious names around. Our company made its mark with full mental business card. mental business card just sits there, quietly waiting to be found.<a href="http://www.metal-card.co.uk"> metal business card </a>. The mental business card represent the front line image of your business, after all, mental business card is very often used to make first contact with a prospect. mental business card is imperative that your primary marketing tools portray professionalism and high quality. [URL=http://www.metal-card.co.uk]metal business card[/URL]
Moreover, efforts put towards your mental business card card, will give your customers a sense of how much attention is brought to your products and services. Our mental business card will help you competing with others to get customers to contact you. mental business card will help you grap attention.
gift bag printing
the gift bag printing and other types of plastic cards for some of the most recognizable and prestigious names around. Our company made its mark with full gift bag printing. gift bag printing just sits there, quietly waiting to be found.
<a href="http://www.printing-gift.co.uk"> gift bag printing </a>. The gift bag printing represent the front line image of your business, after all, gift bag printing is very often used to make first contact with a prospect. gift bag printing is imperative that your primary marketing tools portray professionalism and high quality.
[URL=http://www.printing-gift.co.uk]gift bag printing[/URL]Moreover, efforts put towards your gift bag printing card, will give your customers a sense of how much attention is brought to your products and services. Our gift bag printing will help you competing with others to get customers to contact you. gift bag printing card will help you grap attention.
smart card supplier
You might want to consider a smart card supplier with printing in a vivid color. Like most other types of business cards, smart card supplier ‘s a good idea to keep the design simple. [URL=http://www.smartcard-supplier.co.uk]smart card supplier[/URL]
This is also true of any artwork you might want to use on a unique smart card supplier. The smart card supplier will emphasize your message and make people easy to remember. smart card supplier include many things. A smart card supplier can be printed on bothe sides. A smart card supplier tends to encourage customers to keep it rather than discard it .<a href="http://www.smartcard-supplier.co.uk"> smart card supplier </a>. smart card supplier includes many techniques and tips. And the smart card supplier hasmany types. Owners who are looking for smart card supplier should seriously consider plastic rather than paper cards. Due to their versatility and impact, smart card supplier is a great and cost effective way to promote companies all over the world.
Posted by molly on July 24, 2009 at 03:43 PM CEST #
А подробнее можно?
Posted by Димитрий on July 29, 2009 at 01:45 PM CEST #
Great keep it up, for the sake of the youngsters like us
Posted by medyum on August 21, 2009 at 09:32 PM CEST #
Thank you by admin
Posted by mirc on August 23, 2009 at 04:30 AM CEST #
<a href="http://www.goforstore.com/"><b>buying wow gold</b></a><p>
<a href="http://www.cheap-wow-gold.us/"><b>cheap wow gold</b></a><p>
Posted by 678 on September 07, 2009 at 05:35 AM CEST #
<a href="http://www.cheap-wow-gold.us/cdk-cheap/"><b>wow cd key</b></a><p>
<a href="http://www.worldwarcraft-gold.com/"><b>cheap wow gold</b></a><p>
Posted by 567 on September 07, 2009 at 05:36 AM CEST #
<a href="http://www.worldwarcraft-gold.com/worldofwarcraft-cdk/"><b>wow cd key</b></a><p>
<a href="http://www.powerlevelingsafe.com/"><b>cheap wow gold</b></a><p>
Posted by 567 on September 07, 2009 at 05:36 AM CEST #
<a href="http://ddo.powerlevelingsafe.com/"><b>ddo Registration Key,ddo key
</b></a><p>
<a href="http://www.warcraftgoldstore.com/"><b>cheap wow gold</b></a><p>
<a href="http://ddo.warcraftgoldstore.com/"><b>ddo Registration Key,ddo key
</b></a><p>
Posted by 567 on September 07, 2009 at 05:36 AM CEST #
Хорошая [url=http://www.kurganmachzavod.ru]мксм-800[/url], так держать!
Posted by kurganmach@mail.ru on September 15, 2009 at 08:04 AM CEST #
If you are interested in high quality but low price replica watches, please contact us via our website http://www.progiftstore.com/.
Posted by progiftstore on October 12, 2009 at 09:55 AM CEST #
Email him if you cant find what you are looking for and he will look for you. Good customer service.<a href="http://www.favorluxury.com/">louis vuitton</a>
<a href="http://www.favorluxury.com/">Louis Vuitton Sale
</a>check out her website NOW. Boy I would love to live in her closet for one day.
<a href="http://www.favorluxury.com/">louis vuitton handbags</a>
The prices are kinda high but they are from Aussie so all prices down there escalate. Good selection nothing looks used and they have
<a href="http://www.louisvuittonlive.com/">louis vuitton</a>
<a href="http://www.louisvuittonlive.com/">louis vuitton wallet</a>
Posted by louis vuitton on October 31, 2009 at 12:28 PM CET #