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(); // ...
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.
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.