Is there a way to rename a variable thats be used in the whole method?

Hello Everyone! I am currently using VENUS 4 (currently a student driver) and I want to rename a variable without changing it individually through out the whole method. Is there a quick way to do that without breaking anything? TYIA!!

1 Like

Based on what i heard so far its not possible. At least the bookmarks its working well!

2 Likes

Can you assign the variable you want to rename to a new name and use the new name where you intend to use the new name while still not breaking the references to the old name where you don’t want to use the new variable.

1 Like

Hello thetoly! Thanks for the suggestion and i will try that!

I understand that for Hamilton, it would be difficult to make a completely new editor because of the technical debt in Venus, but I do hope that going forward there will be an attempt to improve the DX within Venus. Things like refactoring, debugging, source control… In this instance, the .med->.hsl compiler should know the usage of a variable across the method so why can’t there be a way to rename a variable across a method?

3 Likes

Hi,

As far as I’m aware there isn’t a straightforward way to do this. However, there is a way to do it that reduces the pain involved somewhat.

In Method Editor, within the Variables and Constants pane, select and delete the variable that you’re wanting to change the name of. Don’t worry, this won’t delete anywhere in your method that the variable is referenced - it just un-declares it. Save your method (make sure to tick “Delete Unused Variables” from the Tools menu). This will generate a list of errors in the Analyzer Output tab of the Output pane referencing everywhere in your method where the now missing/undeclared variable is used. All steps using the variable will also be highlighted in the method. You can now go through and change the variable used in all highlighted steps. As you save your method the list of errors will reduce. In this way you can make sure that you don’t miss a reference to the old variable name by mistake.

Hope that helps!
Will