Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 Auto-generate comment for a function/file or class
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

alanchen
Junior Member

11 Posts

Posted - Sep 24 2014 :  12:21:50 PM  Show Profile  Reply with Quote
With Visual Assistant, is it possible for it to auto-generate a comment for a function/file or a class based on a given template?
Thanks

feline
Whole Tomato Software

United Kingdom
15980 Posts

Posted - Sep 24 2014 :  9:07:53 PM  Show Profile  Reply with Quote
For functions, use the Document Method command:

http://docs.wholetomato.com/default.asp?W161

For a file, you probably want to use a VA Snippet here:

http://docs.wholetomato.com/default.asp?W171

and inside the snippet you can use various reserved strings, given here:

http://docs.wholetomato.com/default.asp?W262

which lets you pick up things like the current file name, which you may well want.

I can provide more guidance if you can post some examples of what you are trying to do.

zen is the art of being at one with the two'ness
Go to Top of Page

alanchen
Junior Member

11 Posts

Posted - Sep 25 2014 :  10:28:19 AM  Show Profile  Reply with Quote
Sorry but in my Visual Assiast, then I click "Refractor" menu, all items are disabled except for "Rename files" and "Create Files...", why?

I have already opened Visual C++ project and VA is enabled as well.

Thanks

quote:
Originally posted by feline

For functions, use the Document Method command:

http://docs.wholetomato.com/default.asp?W161

For a file, you probably want to use a VA Snippet here:

http://docs.wholetomato.com/default.asp?W171

and inside the snippet you can use various reserved strings, given here:

http://docs.wholetomato.com/default.asp?W262

which lets you pick up things like the current file name, which you may well want.

I can provide more guidance if you can post some examples of what you are trying to do.


Edited by - alanchen on Sep 25 2014 10:29:20 AM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
15980 Posts

Posted - Sep 25 2014 :  2:19:16 PM  Show Profile  Reply with Quote
The available refactoring commands are effected by the location of the caret, they are context aware. This sounds like your caret is in white space. Try placing your caret into a function name, on a function declaration or implementation. Document Method should now be available.

zen is the art of being at one with the two'ness
Go to Top of Page

alanchen
Junior Member

11 Posts

Posted - Sep 26 2014 :  7:07:01 PM  Show Profile  Reply with Quote
I have tried the feature and it works perfectly.

Two more questions:

1. Is it possible to insert the month as english apprevication? For example, Sep, Oct, instead of using the month abbrev in locale, since it is not a good practice to insert non-English language in the .cpp file.

2. Is it possible to insert the current user name? Since it is very common to add the current user as the author name in the function comment block.

Thanks

Edited by - alanchen on Sep 26 2014 7:07:11 PM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
15980 Posts

Posted - Sep 26 2014 :  9:01:40 PM  Show Profile  Reply with Quote
Point 1, unfortunately no, but that is an interesting point, I have put in a feature request for this, to add reserved strings that would make this possible:

case=85291

Point 2, for the current user name, just use %USERNAME% to insert this environment variable, as explained here:

http://docs.wholetomato.com/default.asp?W262

zen is the art of being at one with the two'ness
Go to Top of Page

alanchen
Junior Member

11 Posts

Posted - Sep 26 2014 :  10:28:00 PM  Show Profile  Reply with Quote
Seems %USERNAME% is not documented in http://docs.wholetomato.com/default.asp?W262 ? Please add it so that others can utilize this as well.
Go to Top of Page

sean
Whole Tomato Software

USA
2640 Posts

Posted - Sep 26 2014 :  11:01:50 PM  Show Profile  Reply with Quote
This is the page feline meant to direct you to for environment variables:
http://docs.wholetomato.com/default.asp?W263
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
15980 Posts

Posted - Sep 29 2014 :  09:04:58 AM  Show Profile  Reply with Quote
My mistake, the link Sean posted was the one I had looked up for you, but somehow I managed to post the wrong link. Hopefully this helps to explain how to use environment variables in your snippets, including Document Method. If you have any problems with this then please just ask.

zen is the art of being at one with the two'ness
Go to Top of Page

sean
Whole Tomato Software

USA
2640 Posts

Posted - Apr 10 2015 :  11:28:12 PM  Show Profile  Reply with Quote
case=85291 is fixed in build 2062
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2019 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000