Tool to refactor "with" blocks

refactoring examples
code refactoring tools java
refactoring java
martin fowler refactoring
refactoring techniques
refactoring patterns cheat sheet
refactoring in agile

Is there a refactoring tool to remove "with" blocks? For example convert

with Form1 do
  Height := Blah;
  Blubb := Name;


Form1.Height := Blah;
Blubb := Form1.Name;

where Form1 is a VCL TForm. Optimally it should work with Delphi 2007.

...I think the last Castalia from Jacob Thurman/TwoDesk Software do the trick

Refactoring, But such tools aren't essential - I often work in programming languages without tool support, in which case I rely on taking small steps, and using frequent testing to  If you'd just like to see refactorings without Quick Fixes, you can use the Refactor command (⌃⇧R (Windows, Linux Ctrl+Shift+R)). Note: If you prefer to not see the Code Action lightbulb in your editor, you can disable lightbulbs with the editor.lightbulb.enable setting .

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".

Code refactoring, Use of Project Analyzer to refactor VB code​​ Project Analyzer is a tool that helps refactor existing Visual Basic code. It is useful in two ways. Some examples are Extract a method refactoring and Move type to a matching file refactoring. For information about refactoring C++ code, see Write and refactor code (C++) . Refactoring support for F# is provided by the Visual F# Power Tools , a third-party Visual Studio extension.

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

Refactoring tools, ) (computing) To rewrite existing source code in order to improve its readability, reusability or structure without affecting its meaning or behaviour. Resource Refactoring Tool allows easy extraction of hard-coded strings from Visual Basic, C#, XAML, ASPX and code to resx files.

refactor defined, Refactoring Tools. Posted March 23, 2015 at 8:52 am by Heidi & filed under Tips. We have recently added a great new feature to Understand to make any of  DMS is also used to build arbitrary source analysis tools. Examples include clone detection, test coverage, smart difference (comparision of source code structures and abstract editing operations rather than lines with simple insert and delete), etc. What it is not (presently) is an interactive refactoring tool.

Extract method - Help, Invoke refactoring. Select an item to refactor. You can select a file/folder in the Project tool window or expression/symbol in the editor. Press Ctrl+Shift+Alt+T to  Refactoring is a preview feature of IntelliCode, so when you get Visual Studio 2019 version 16.3 Preview 3 it will be off by default. Visit the Tools-Options page, IntelliCode General tab, Preview features area, and switch C# refactorings to “Enabled” to turn it on.

Refactoring Tools, I am frustrated because I miss a great tool to perform automated refactorings for me. And neither VS Code, neither existing extensions provide the  This article lists top things a SQL formatter tool needs to have How to format SQL like a pro – formatting to implicit Microsoft standards and guidance In this article, we describe how to implement MSDN, SQL Server online documentation, and Adventure Works formatting standards with ApexSQL Refactor

  • I don't think there's something like this, it requires a lot of parsing that needs to go down to a TObject decendant in order to achieve this...
  • As a sidenote: The difficulty in implementing that refactoring is exactly the reason why with can be dangerous!
  • @Smasher, as the compiler can resolve the with, so should do a refactoring. The result might not be what you expect.
  • @Smasher: There is no such difficulty. The code compiles and does what it is directed to do. Any refactoring simply needs to reproduce the scoping rules that the compiler follows. The "dangers" you are thinking of stem from the fact that the debugger doesn't follow these rules properly itself when it comes to "with". "with" would be less of a problem (tho not entirely benign) if the debugger worked properly.
  • @Smasher - the point is, yes it's difficult but that is no impediment to creating a reliable "with refactoring". The rules that the refactoring has to follow don't have to be deduced, they are already written and embodied in the compiler. Presumably the devs working on the debugger code similarly just gave up and said "Yes, we could fix it but it's too difficult. Oh woe how it sucks to be us.". Yet somehow the compiler team managed, as evidenced by the fact that the compiler, um, does it. :)
  • ... and because you were faster :)
  • +1 of course. I accepted User0815's answer to support the SO newbies. :-)
  • I can live with that. The other answer is equally correct and just two minutes behind mine.
  • The other answer has no link, so I accepted yours :-)
  • After I read your answer, I just tried it. It didn't really help much. In all tests the automatically generated code didn't compile and it was faster to do the conversion by hand.
  • @dummzeuch, I found it most useful for huge (tens of lines) withs. It has several options, which might make removal easier. However, it is still a simple text tool, not a refactoring, and it's a matter of taste, so I will not insist.