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
 Search for constant value
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

foxmuldr
Tomato Guru

USA
402 Posts

Posted - Aug 29 2023 :  08:57:22 AM  Show Profile  Reply with Quote
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

feline
Whole Tomato Software

United Kingdom
18938 Posts

Posted - Aug 30 2023 :  06:19:14 AM  Show Profile  Reply with Quote
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

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

foxmuldr
Tomato Guru

USA
402 Posts

Posted - Aug 31 2023 :  5:28:09 PM  Show Profile  Reply with Quote
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

Edited by - foxmuldr on Aug 31 2023 5:43:03 PM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18938 Posts

Posted - Sep 01 2023 :  08:16:56 AM  Show Profile  Reply with Quote
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.

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