T O P I C R E V I E W |
znakeeye |
Posted - May 09 2008 : 10:13:14 AM 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. |
3 L A T E S T R E P L I E S (Newest First) |
znakeeye |
Posted - May 09 2008 : 4:40:45 PM True, but requires more work ;P |
feline |
Posted - May 09 2008 : 11:13:37 AM 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. |
znakeeye |
Posted - May 09 2008 : 10:16:50 AM Of course this would be great to have for all types of code blocks. You simply have to handle the press of the '{'-key! |