Is there a 'Rename Unit' refactoring available in Delphi (or in an add-on, eg Castalia?) I want to rename several dozen units to give them scoped (dotted) unit names, and I want all the uses clauses in the project to be updated automatically too. And it also needs to integrate with version control so the files are renamed in SVN, not just on disk.

Is there a 'Rename Unit' refactoring available in Delphi (or in an add-on, eg Castalia?) I want to rename several dozen units to give them scoped (dotted) unit names, and I want all the uses clauses in the project to be updated automatically too. And it also needs to integrate with version control so the files are renamed in SVN, not just on disk.

Renaming via the Project Manager doesn't do this. There's no rename unit refactoring in the IDE's menu I could spot. I installed Castalia, but can't find one there either. I'm very much afraid I might have do it all manually. But this seems odd since it seems a useful and possibly quite common thing to do.

Comments

  1. Lazarus seems to handle renaming in the IDE better than Delphi. If I "Save as..." there, the units and uses clauses in the project are adjusted and the old file is deleted.

    ReplyDelete
  2. Lübbe Onken Save As is different from Rename. Same for any Windows application: Save As of file saves a new copy and keeps the old file. That's why in Delphi you can perform rename in the project manager using the context menu or F2 key.

    ReplyDelete
  3. Maybe we should call "save as" in Lazarus a disguised F2 Jeroen Wiert Pluimers​? :)

    ReplyDelete

Post a Comment