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
 Copy and paste with automatic replace
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

charfeddine.ahmed
New Member

Tunisia
4 Posts

Posted - Nov 17 2008 :  08:41:30 AM  Show Profile  Reply with Quote
A very often thing done in code editing, is to copy a snippet of code, a line or even a whole bloc,let's say blocA (the source bloc to be copied) then paste it on top of a certain code bloc (let's say blocB) before it will be corrected by replacing a certain keyword from blocA by a keyword from blocB.

To do that I often use notepad as extra storage to the clipboard.

Let's formalize this :

We have a codeblocB that need be changed : for instance :

..
pParentEngine->getIntelligenceBase()->getRuleByID(ruleID)
..

codeBlocB is function of a keyword keywordB (here it is ruleID)

codeblocB=codeBlocB[keywordB]


codeblocA is as follows :
GetDirectRule(id);

so :
codeblocA=codeblocA[keywordA] where keywordA=id in this sample.


So I select codeblockA, copy it, then select codeblockB, paste codeblocA, then replace keywordA with keywordB.


To do this easily we can add a sort of "smart paste and replace" command that is shown in the popup menu when we click on the hovering button when, we select codeblockB.

when we choose the command, I expect VAssistX to ask me about the keywordB when there is an ambiguity. When things are OK then codeblockB is just in memory.

To apply the final thing, I go to codeblockA, select it, prompt the pp menu from the hovring button, then choose another smart command that will do the replacing and if there is an ambiguity about the keywordA to be restored in place of keywordB then it just but asks me to help it.

Or so do I see things. 'dreaming ? Then let Whole Tomato let the dreams come true !



I love chess and I love XML files.

feline
Whole Tomato Software

United Kingdom
18943 Posts

Posted - Nov 24 2008 :  12:53:26 PM  Show Profile  Reply with Quote
I don't understand. Can you post the code you are copying, the code before the paste and the code after the paste. Then maybe I will be able to see and understand what you are asking VA to do.

zen is the art of being at one with the two'ness
Go to Top of Page

charfeddine.ahmed
New Member

Tunisia
4 Posts

Posted - Nov 25 2008 :  03:27:18 AM  Show Profile  Reply with Quote
I'd like to copy the code bloc A :
GetDirectRule(id); 


and replace the following code bloc B with it :
pParentEngine->getIntelligenceBase()->getRuleByID(ruleID)


Finally I have to change the id keyword by the ruleID one since it is the one that goes with the current context.
The above suggestion is a way to do that fast without the need to make multiple cut/pastes or the need to recorrect the replacing code.

I love chess and I love XML files.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18943 Posts

Posted - Nov 25 2008 :  09:17:59 AM  Show Profile  Reply with Quote
So the code would change from:

pParentEngine->getIntelligenceBase()->getRuleByID(ruleID)

and become:

GetDirectRule(ruleID);

?

if so then I do not understand how VA is supposed to work out what you intend. You are changing the name of the function call. You are preserving the parameters of the final function, but what if the code line had read:

pParentEngine->getIntelligenceBase(oldRuleID)->getRuleByID(ruleID)

before the paste? Then what?

zen is the art of being at one with the two'ness
Go to Top of Page

charfeddine.ahmed
New Member

Tunisia
4 Posts

Posted - Nov 27 2008 :  10:45:13 AM  Show Profile  Reply with Quote
Exactly.
As of how VAssist would work out the thing...I believe given some existing refactoring possibilities in VAssistX, it is also possible to do that,too..
Well, I would not imagine the thing you supposed. Because what I'm talking about is a simple theme, a simple programming process that is often repeted.

I love chess and I love XML files.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18943 Posts

Posted - Nov 28 2008 :  08:23:00 AM  Show Profile  Reply with Quote
I still have no idea what you actually want VA to do here, or how VA could do anything helpful here.

zen is the art of being at one with the two'ness
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