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
 Introduce return variable
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

pjwhams
Senior Member

25 Posts

Posted - Jan 13 2015 :  07:50:51 AM  Show Profile  Reply with Quote
Something I find myself doing a lot is writing the function call first then I want to introduce a variable to capture the return value. However I either need to hover over the function to see the type of the return variable or use alt-g to go to the definition so I can copy and paste the type.

What I'd love is an 'introduce return variable' where you select the function call then VA will prompt for the variable name and introduce it with the correct type (or optionally with 'auto')


   // declaration of function we're going to call
   std::vector<SomethingLong> doSomething() 

   // type this:
   doSomething() 

   // now open VA menu and choose 'introduce return variable': 
   std::vector<SomethingLong> var=doSomething()


accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Jan 14 2015 :  08:05:38 AM  Show Profile  Reply with Quote
This is already possible with Introduce Variable. You just need to select the call and trigger the command:



However, we are already considering Introduce Variable to work without a selection:

case=84978

We may even decide to call it a "Introduce return variable", since it would explain to the user what will happen.

Thank you for the helpful feedback.

Edited by - accord on Jan 14 2015 08:15:25 AM
Go to Top of Page

pjwhams
Senior Member

25 Posts

Posted - Jan 14 2015 :  10:22:10 AM  Show Profile  Reply with Quote
Ah, I never thought of using Introduce Variable in this instance -- that's great, thanks.
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