question:

You need to replace references to the variable "terrainHeightValue" in your code with "terrainHeatValue". You know it's limited to one function, and there are 5-8 instances to be replaced.

What do you do?

Follow

@PHolder Find & replace is much faster when you know the variable only exists in a limited section of text.

But also, I was limited to 4 options in the poll. 🤷‍♂️

@LouisIngenthron Ummm.. I guess you've never used Eclipse IDE. I highlight the "bad" variable name then I hit the refactor->rename (there is a keypress for it, I just don't use it) and then and then overtype the new name and press enter. It finds ALL the correct places (cause it understands the code) and just does the necessary replacement. Quick/easy/painless.. it knows how to do it better than I would in the sense it won't accidentally miss any occurrences I might.

@PHolder Same works with Visual Studio, and it works fine in smaller codebases, but in larger ones, it can take a few seconds to check every file for references.

With find & replace, otoh, I can highlight the variable name, press Ctrl+H and it prefills the "to replace" field and puts my cursor on the "replace with" field. Type it in and press enter and it's done, with no delay and only one mouse click.

@LouisIngenthron
>it can take a few seconds to check every file for references.

Okay but, your original question was "You know it's limited to one function"

I don't use Visual Studio, but Eclipse seems to know enough context when the variable is local to a single function and only quickly makes the changes there, not requiring checking anything/anywhere else.

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.