Menu

#233 RenameIdentifier improvement

New
open
nobody
Improvement (1)
5
2026-05-14
2026-04-23
No

The RenameIdentifier function displays a field in which you can enter a new identifier. It would be great if this dialogue box also included a checkbox to indicate whether the new name should be used in the comments too.

Discussion

  • Thomas Mueller

    Thomas Mueller - 2026-04-23

    This can be really dangerous. Imagine somebody renaming a variable that is a common word, like "make" to e.g. "MakeItSo". Changing occurrences of that word in all comments would make the comments unreadable.

     
  • Grzegorz Skoczylas

    People would use this function, wouldn't they? People should think about what might happen. So, if you're naming your function 'make', it might be better not to check the option to change that word in comments as well.

    I think good code speaks for itself and doesn't need loads of comments. So, the risk of an unintended change to a word in a comment seems low. But it'd be really useful to have that option for the documentation comments. At the moment, in Delphi, we have special comments starting with '///'. I started writing some of my libraries in older versions of Delphi and I still use PasDoc documentation comments in them (my PasDoc documentation comments start with '{:').

    Before committing code to Git, I always review the changes to catch any test code left behind by mistake or temporary TODO comments, etc. That's when I'd probably spot an unintended change to a word in a comment.

    I still think it'd be handy to have a checkbox like that, but perhaps it shouldn't be checked by default.

     

    Last edit: Grzegorz Skoczylas 2026-04-24
  • Thomas Mueller

    Thomas Mueller - 2026-05-14

    Ticket moved from /p/gexperts/bugs/482/

     

Log in to post a comment.

MongoDB Logo MongoDB