Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Surrounding lines with if() {...} ?

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
Zeblote Posted - Jun 01 2018 : 05:46:38 AM
More of a question that support... just today I found some "surround with" feature of VA, but can't figure out how to use it correctly.

What's the quickest way to turn



into



?
5   L A T E S T    R E P L I E S    (Newest First)
sean Posted - Jun 01 2018 : 1:07:11 PM
For the Surround With field, I've found that using upper-case letters is more useful than lower-case letters.
T -> wrap in try/catch block
N -> wrap in namespace
R -> wrap in raw-string literal delimiters
F -> wrap in for loop
Zeblote Posted - Jun 01 2018 : 11:20:11 AM
Oh, I didn't know it was possible to bind a key for that. Have set it up
feline Posted - Jun 01 2018 : 10:14:04 AM
There are very few if any "simple" keyboard shortcuts that are not already taken by the IDE or VA. Alt + letter opens a menu if there is a matching menu item, and the menu items vary depending on the file type you have open. You can try a less commonly used key on the keyboard, but you still risk having the same problem.

Personally I have mapped the keyboard shortcut Ctrl+# (Text Editor) to the command VAssistX.VaSnippetInsert.

When I have selected a block of text I press Ctrl+#, and then scroll through the menu list of snippets using $selected$ until I get to the one I want. Simple and easy, and not something I tend to trigger by accident.
Zeblote Posted - Jun 01 2018 : 06:58:06 AM
Ohh, I get it now! So that's what the little box is for... works great!

Now I'm sometimes triggering it accidentally though. Would it be possible to bind these to key combinations that you don't normally use when typing, like alt-i?
feline Posted - Jun 01 2018 : 06:11:43 AM
Go to the VA Snippet editor, and set the search fields to:

Scope = Private
Language = C++
Type = Surround With

in the list of snippets you should see three versions of "if", for this code you are looking for the line "if () { ... } if"

Select this one, which will have the body - assuming you have not edited this default snippet yet:

if ($end$)
{
    $selected$
}

and then set the "Surround With" field to "i" and accept the dialog. To use this snippet select the code you want to surround, and with the code selected press the letter "i", and this snippet will be triggered.

More generally, you can set a single character shortcut to trigger any snippet that uses $selected$ to trigger this snippet on selected text. $end$ is where the caret ends up after the snippet has been inserted.

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000