Is there a refactoring tool to remove "with" blocks? For example convert
with Form1 do
begin
Height := Blah;
Blubb := Name;
end;
to
Form1.Height := Blah;
Blubb := Form1.Name;
where Form1 is a VCL TForm. Optimally it should work with Delphi 2007.
Code refactoring is a controller technique or process of restructuring your code without changing its external behavior for easier maintenance, better readability, understanding, and extended support. The main purpose of refactoring is to fight technical debt.
Do one of the following: On the main Refactor menu or from the context menu of the selection, choose the desired refactoring or press the corresponding keyboard shortcut (if any). From the main menu, choose Refactor | Refactor This, or press Ctrl+Alt+Shift+T , and then select the desired refactoring from the popup.
Model Maker Code Explorer, which became free recently, has "Convert with statement" tool. While it is not a fully automated refactoring, it might be useful, if Castalia does not work
One of the Castalia refactoring tools is named "Eliminate 'WITH'".
I can't comment on how well it works in non trivial code because I tend to avoid "with".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With