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
 Technical Support
 Add a statement to print the current variable
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

fspafford
Senior Member

USA
45 Posts

Posted - Nov 19 2016 :  7:15:44 PM  Show Profile  Reply with Quote
Is there any feature in Visual Assist that would allow me to add a print statement to print the current variable by adding a print statement to the C++ source file?

For example, take this line"

nCount = x + 1;

If I put the cursor over nCount, I want to add a statement after the line like:

trace("nCount %d", nCount);

Regards,

Frank

ChrisG
Whole Tomato Software

USA
299 Posts

Posted - Nov 19 2016 :  8:47:52 PM  Show Profile  Reply with Quote
Hi fspafford,

You could create a new VA Snippet similar to the one shown in the attached screenshot.

To use it, you would need to have the name of the variable you wish to trace copied to your clipboard. Then, you can just move your cursor to where you want the trace to go in your cpp file and press 't', then 'tab' to create the snippet.



Since we don't support mouse hover as input for a VA Snippet, it's not exactly what you're asking for. It will be interesting to see if the developer of the feature has considered mouse hover being used as input before! I like the idea and will mention it to him.
Go to Top of Page

ChrisG
Whole Tomato Software

USA
299 Posts

Posted - Nov 22 2016 :  12:46:25 PM  Show Profile  Reply with Quote
Also, here is a great way to add that snippet to your copy of Visual Assist.

First, copy the xml below into your clipboard.

<VA_Snippet>
<Language>C++</Language>
<Title>Trace</Title>
<Shortcut>t</Shortcut>
<Description>Trace the variable currently in the clipboard.
</Description>
<Code>trace("$clipboard$ %d", $clipboard$);</Code>
</VA_Snippet>

Then, open the VA Snippet Editor, and paste the code in using [Ctrl-V].
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