merino icon indicating copy to clipboard operation
merino copied to clipboard

name refactoring

Open radiatoryang opened this issue 6 years ago • 1 comments

there are at least two Yarn name types we'd want to be able to refactor:

  • node names
  • variable names

node names in Yarn are very important...

  • nodes link to each other via node names
  • there can be no duplicate node names, validation is needed

however, "never changing your node names" makes it difficult to reorganize a complicated story sometimes

so, it would be great if Merino could automatically change node name references if you rename a node

  • renaming a node that is referenced in another node should prompt a refactoring confirmation pop-up, where merino asks to find and replace all instances of that node name throughout the whole yarn file
    • detecting node references would likely require a regex, to make sure it's referenced within double brackets like [[NodeName]]
  • also perform validation and make sure there are no duplicate node names in the file
  • also include a "disable refactoring pop-up" etc. setting in the Merino Editor Preferences page

and then, do the same for variable names (like $variableName) as well

for now, unassigned / with no timeline on when this will happen, unless everyone starts screaming that they need this much sooner

radiatoryang avatar Sep 08 '18 18:09 radiatoryang

Renaming nodes won't be an issue thanks to the RenameEnded method.

On the other hand, variable names will be a bit more tricky to implement UX wise, The quickest/easiest way to implement the functionality would be via a find and replace all prompt.

Edit: Due to variables being used across a project it would actually be best if variable refactoring was implemented through a prompt so the user can specify the scope of the files which would be affected.

addie-lombardo avatar Sep 08 '18 18:09 addie-lombardo