Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Introduce return variable

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
pjwhams Posted - Jan 13 2015 : 07:50:51 AM
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()


2   L A T E S T    R E P L I E S    (Newest First)
pjwhams Posted - Jan 14 2015 : 10:22:10 AM
Ah, I never thought of using Introduce Variable in this instance -- that's great, thanks.
accord Posted - Jan 14 2015 : 08:05:38 AM
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.

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