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
 Feature Requests
 Optional comment on end of
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Sasa
Tomato Guru

272 Posts

Posted - Jan 19 2006 :  12:46:10 PM  Show Profile  Reply with Quote
This suggestion is very neat and could well be a good feature as an "autoinsert end of block comments" feature for VAX :)

Taken from codeproject:

Have you ever wrote a bunch of code which looked like this:



Ok, I admit this isn't a very good style of programming, but sometimes it can't be avoided. And in those cases the code is horrible to read because you don't know which closing brace belongs to which opening statement without scrolling or using the macro 'Edit.GotoBrace' several times. VAX should provide a auto function which inserts comments after the closing brace automatically.



Comments are only inserted for closing braces of if, while, for and switch statements { configurable by user }.

If you don't want to insert comments automatically while editing, you can turn off this function. If you just don't want those comments at specific places you have to move the caret either upwards (instead of downwards which happens if you press enter) or click with the mouse so that the caret doesn't go to the line below the closing brace. Comments are also not inserted when the opening brace is less than two lines above { configurable by user }.

Tell me what you think.

C++
Visual Studio 2008 Pro
Windows 7 x64

feline
Whole Tomato Software

United Kingdom
18939 Posts

Posted - Jan 19 2006 :  1:57:05 PM  Show Profile  Reply with Quote
i thought i recognised it, this is from the tool:

http://www.codeproject.com/macro/kingstools.asp

the primary problem with this is how it would fit into the existing way VA works. look at the autotext rules that insert for() blocks, while() blocks, etc. when the block is inserted you do not have a complete for or while like with which to produce a comment.

this leads to the idea of VA having to "jump in" as you move past an end bracket, or having a keyboard shortcut / toolbar button to trigger the insertion of the comment.

never having used this feature, how does kingstools get around this problem?

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

Sasa
Tomato Guru

272 Posts

Posted - Jan 19 2006 :  2:25:03 PM  Show Profile  Reply with Quote
quote:
this leads to the idea of VA having to "jump in" as you move past an end bracket, or having a keyboard shortcut / toolbar button to trigger the insertion of the comment.

This is what I have thought too. I mean VAX already detects tokens while editing like the ".", "->", etc...

I though of something of the like:
-detect closed curly bracket ( maybe on enter keypress after a closed bracket?)
-see if matching open bracket is an if, while, for, switch ( or user configurable )
-if true
-Appendranch statement ( if( i == x ), etc...) as comment to the end of the close bracket

Seems straight forward enough, at least on paper.

I cannot install Kingstool because I only have VS2005 currently on my system.

C++
Visual Studio 2008 Pro
Windows 7 x64

Edited by - Sasa on Jan 19 2006 2:29:54 PM
Go to Top of Page

support
Whole Tomato Software

5566 Posts

Posted - Jan 19 2006 :  8:16:47 PM  Show Profile  Reply with Quote
We have considered the feature but opt not to implement it. Instead, we put "if" and the like in the Content field of our wizard bar, and we support jumping to an opening brace from anywhere within a pair. Try Alt+Up Arrow.

http://www.wholetomato.com/products/features/move.html?more=yes
Go to Top of Page

Old as dirt
Tomato Guru

USA
246 Posts

Posted - Sep 14 2007 :  1:31:40 PM  Show Profile  Reply with Quote
What I've done doesn't involve VA but rather the macro recorder.
I go to the ending brace and start the macro recorder then press CTRL-} to get to the opening brace then press SHIFT-Home to highlight from the beginning of the line to the opening brace. Then press CRTL-C to copy that to the clipboard. then press the right arror key which takes the cursor back to the opening brace. Then press CRTL-} again to get back to the ending brace. Then press the right arrow key to get behind the closing brace. Then I type a space or tab and // end and then press CTRL-V to past what this is the end of. Then I stop the recorder and after that you just press CTRL-SHIFT-P to play back the macro. I have to first go to the starting brace to make sure it is something that this will work on. I don't work with macros enough to know how to assign a different hot key so that I could have more than one of these recorded macros. That is fortunate bacause I've never needed to record but just this one.

Ken
Go to Top of Page

sl@sh
Tomato Guru

Switzerland
204 Posts

Posted - Sep 17 2007 :  05:12:07 AM  Show Profile  Reply with Quote
You could just modify the
if (...){
   //...
}

autotext entry to
if (...){
   //...
} // if


Same for other keywords like do, while, for, switch, etc.. You might also adapt else blocks in this manner. You still won't be able to discern several levels of for loops or if statements, but it might still be helpful
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000