sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Code-generators/macros should provide a way to "bundle" renaming

Open rrousselGit opened this issue 1 year ago • 3 comments

Hello! This is similar to https://github.com/dart-lang/sdk/issues/56518, but for another core IDE functionality: Renaming.
I am worried that the current macro proposal fails to solve the renaming issue.

One way code-generators and the upcoming macros often work is by generating a new identifier, based on a user-defined identifier. Like @example class UserDefined vs userDefinedGenerated, where the latter is generated based on a string transformation of the former.

The problem is, renaming renaming one of the two identifiers won't rename the other.

  • Renaming @example class UserDefined will correctly update the generate code, but any existing reference to userDefinedGenerated will stay unchanged. Users will then have to modify those by hand ; which can be very tedious and error prone.
  • Renaming userDefinedGenerated will not update UserDefined ; which means re-generating the code will revert our rename.

It would be great for the IDE to be able to rename both the generated and user-defined identifiers at once.

rrousselGit avatar Sep 21 '24 16:09 rrousselGit