Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Search for constant value

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
foxmuldr Posted - Aug 29 2023 : 08:57:22 AM
Today I needed to search for a value (1800000000). It's a constant used various places throughout the app, and I wanted to move it into a symbol rather than a hard-coded constant value.

Would it be possible to allow the Alt+Shift+F to work on unknown symbols if, for example, you're sitting atop a numeric value? And even Alt+Shift+R to replace it with a symbol name?

I am able to use Visual Studio's find and replace features, but if I could use Alt+Shift+F and Alt+Shift+R it would be nicer.

--
Rick C. Hodgin
3   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Sep 01 2023 : 08:16:56 AM
Doing this with VA is fair, but what can VA really offer over a simple global find and replace in this situation? Once the variable has been introduced, you simply want to do the find and replace. Or do you want / need to preview all of the results first? But even then, since this is just a straight text search, with no context awareness, the IDE find should be enough.

I am not sure what VA can be, or should be offering here.
foxmuldr Posted - Aug 31 2023 : 5:28:09 PM
In my case, the scope would be solution-wide. I was replacing a constant 1800000000 with an actual name (like MY_VALUE or something). Shift+Alt+Q would've been nice to know. I'm not sure if it would work solution-wide because it's reference was inside an if () expressions inside a function somewhere, as were all of the references system-wide except for its definition, which I would've had to introduce globally. So, would it introduce a global variable or one scoped to the local function?

I think when refactoring a constant there should be an option to relax context restrictions and pull through all of them in the solution. The user can select or unselect those ones they want to change like normal. Maybe a variation, a Shift+Alt+W if it's not used.

Of course you'll say use the facility already in Visual Studio. I did, and I can, but I like VAX better.

In my particular case, this project has about 35K lines of code, and that unique number was used around 8 places. So it wasn't something common like trying to replace a 0 globally which is likely used in many many places.

--
Rick C. Hodgin
feline Posted - Aug 30 2023 : 06:19:14 AM
The problem with Find References and Rename is that they are designed to be code aware, rather than a simple text search. Since they rely on understanding the context of the symbol you are searching for, they cannot do a code search on an unknown symbol. If they just did a simple text search, they would be no different to the IDE's Find and Replace commands.

Are you aware of the Introduce Variable command? This is partly designed to convert a number constant into a variable:

https://support.wholetomato.com/default.asp?W514

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