Forum

Feature request: Duplicate should update calls to nested elements (and possibly rename)

When I duplicate an object definition that contains static operations or other definitions it will also make copies of any internal definitions.
That’s good.

Then immediately something turns red because now some operations have the same name. This also makes sense. I can copy and paste the node into a new category (.old) to prevent the error but the internal references still point to original definitions.
I don’t usually have complex definitions inside objects but commonly will have some static operations unique to a process or class.

This often becomes a pain point when I want to work iteratively.

  • One case is duplicating a complex process so I can make some updates. Then I want to compare it to the old process and see if there is a performance improvement. Currently I have carefully go through the duplicate and rename child definitions and ensure internal references point to the renamed children.
  • Another case is simply archiving previous versions of objects in the patch for reference. Sometimes I want to check how I solved a problem the old way.
  • Third case is genuinely want a unique version of an object including its child definitions.

I know I could achieve some of this at the file system level by copying entire documents but that’s also a pain.


The feature request is for a new command ‘duplicate and rename children’.

  • It would give you a dialog to specify a postfix string to add to the new name
  • It would also rename all internal child definitions with the same postfix and update the references in the duplicate to point to the renamed children inside the duplicate.

OR could be a feature of solution explorer, append+rename all children.


I also note that Ctrl-D currently works as a duplicate command but is not documented in the gray book.

2 Likes


For example this is a class with a manual serialiser and deserialiser for a reasonably complex application.
The static operations are needed to organise it or it would be an even bigger nightmare.

My ideal workflow when iterating this would be copy the definition then make my changes.

The old version with the old children would still exist if I wanted to swap back to the entire old one OR if I just wanted to reference an old version of an internal static operation.


Currently if I copy this whole definition the internal calls still reference the nested operations in the original definition.

An improvement would be if duplicating pointed internal calls to duplicated nested definitions as well.
Then I could just go through the nested elements list in the duplicate and rename each one and be sure I was renaming both the objects and the correct calls to those objects.

4 Likes