-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Code-generators should provide a way to "bundle" renaming #56764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Summary: The current macro proposal doesn't address the issue of renaming generated identifiers. Renaming a user-defined identifier doesn't update the generated identifier, and vice versa, leading to inconsistent code and manual updates. The IDE should be able to rename both identifiers simultaneously for a seamless experience. |
Gentle bump :) The difference between fixing renaming and not fixing it would be huge. |
I agree; the rename operation, along with the rest of the tooling, needs to be made to work well with macros, and that if we do nothing they won't. The reason there's been no movement here is because we're busy working on the enhanced-parts and augmentations features, both of which are prerequisites for fully supporting macros. I suspect that we'll solve the second half of the problem--renaming a generated declaration--by simply disallowing it. We don't generally support modifying generated code, and I don't see why a rename would be any different. If we had a way of associating the generated name with the name(s) from which is was derived, and a way of reversing that derivation, then maybe we could support something like this, but we don't, and it isn't clear that it would be an improvement to the DX. I don't know what the best way is to solve the first half of the problem, but I'm happy to discuss possible solutions. For example, what if, every time a rename operation is performed, we were to look to see whether there are any macros being applied in the enclosing library (I think that's the right scope, but I might be mistaken about that), and if there are take the following steps.
That assumes that the order of the declarations is stable wrt the names of the declarations (that is, that nothing is sorting the declarations after they've been generated). Otherwise it won't be possible to produce a meaningful diff. I think this would solve the problem, but I might be missing something. It's also possible that there's a better way to solve the problem. Evaluations and ideas welcome. |
Closing, as we are no longer working on the macro feature. |
I disagree, this shouldn''t be closed. This impacts code-generators too. |
Sounds good, reopened and edited labels. |
Hello!
This is similar to #56518, but for another core IDE functionality: Renaming.
One way code-generators often work is by generating a new identifier, based on a user-defined identifier.
Like
@example class UserDefined
vsuserDefinedGenerated
, 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.
@example class UserDefined
will correctly update the generate code, but any existing reference touserDefinedGenerated
will stay unchanged. Users will then have to modify those by hand ; which can be very tedious and error prone.userDefinedGenerated
will not updateUserDefined
; 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.
The text was updated successfully, but these errors were encountered: