📜 ⬆️ ⬇️

Attribute Refactoring Support in Delphi 2010

Refactoring I mentioned earlier that in this release most of the work was devoted to additional functionality and improvements. As a result, the IDE continues to surprise me. I try to do something without even thinking about whether it will work at all, and I find that it does not just work, but works even better than I could have imagined.

One example concerns support for attribute refactoring.
If you look at my first example , you will notice that an awful name was chosen for the attribute. MyAttribute is not the best choice, until I want to use only one attribute.

No problem, Delphi has been refactoring rename identifiers for quite a while. I'll just use it. Right click on the identifier, select Refactoring -> Rename , set a new beautiful name, for example NameAgeAttribute and click OK .
')
At that moment, I expected only renaming the class name in the code everywhere, but in part I expected that for [MyAttribute ...] this would not work. And I definitely didn’t expect that the places where I dropped the attribute Attribute would be processed.

Now look at the picture below and you will see how much I underestimated this opportunity.

Attribute refactoring

Refactoring properly handled each case. The code compiles and works just like before.

Well done guys!



You can help improve the translation.
translated.by/you/refactoring-support-for-attributes-in-delphi-2010/into-ru
Translators: r3code , debose

Source: https://habr.com/ru/post/85503/


All Articles