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
 If-statements
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

znakeeye
Tomato Guru

379 Posts

Posted - May 09 2008 :  10:13:14 AM  Show Profile  Reply with Quote
90% of the time when I write an if-statement I want to enclose the subsequent lines in the if-block. That means I get upset 90% of the time when I get this type of code:

if (condition) {
foo(); // Present code...
bar(); // ...

yields:

if (condition)
{
}
foo(); // Present code...
bar(); // ...

But I want:
if (condition)
{
foo(); // Present code...
bar(); // ...
}

Hence, an ingenous solution would be to highlight where the enclosing bracket should be placed, and let the user move it using VK_UP/VK_DOWN and accept using VK_RETURN. Default would be to add it just after the bracket. Thus, I would type this to get what I want:

if (condition) { VK_DOWN VK_DOWN VK_RETURN

An addition would be to analyze if a keyword is placed just after the '{' and then default to "include the next statement" -- eliminating the need for a VK_DOWN.

znakeeye
Tomato Guru

379 Posts

Posted - May 09 2008 :  10:16:50 AM  Show Profile  Reply with Quote
Of course this would be great to have for all types of code blocks. You simply have to handle the press of the '{'-key!
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18952 Posts

Posted - May 09 2008 :  11:13:37 AM  Show Profile  Reply with Quote
Select the block of code, and then trigger the correct "if" VA snippet. You will want a snippet like:

if($end$)
{
    $selected$
}


which you should already have in your snippets list. If code is selected when you trigger insert VA Snippet then only snippets that use $selected$ are listed.

You can also just select several lines of code and press '{' to surround them with curly brackets, assuming you have turned on surrounding code.

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

znakeeye
Tomato Guru

379 Posts

Posted - May 09 2008 :  4:40:45 PM  Show Profile  Reply with Quote
True, but requires more work ;P
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