Jump to content
balabuev

RAD Studio 13. Refactor menu is always disabled.

Recommended Posts

Why "Refactor" item in main menu is disabled (Delphi 13). As well, the refactor related items in the editor context menu are disabled. This does not depend of context, e.g. whether a project opened in IDE or not, whether current unit contains some specific code (like inline variables) or not. It simply disabled always. Whether this functionality is implemented in a separate IDE package, which I may unintentionally uninstalled?

 

image.thumb.png.9e11750705289f572207bad91d93db90.png

 

image.thumb.png.5a50a90537b7f49f54f91e14f2e73e64.png

 

 

Share this post


Link to post

Because there is no refactoring out of the box anymore. Same as code formatting. The only way to get that enabled is via third party tools (very possibly not free), that will take care of refactoring. That is Embarcaderos official position.

Share this post


Link to post

What???!!! With every new version Delphi becomes better and better 😡 Moreover, some functionality which even does not change the code is also no longer working:

 

1) Ctrl+G - Go to declaration. While same functionality via Ctrls+Click still works.

2) Shift+Ctrl+Enter - Find all usages of variable/method/etc. This is a big Embarcadero fail. Very big 😡!

 

So, the last usable version is Delphi 12...

 

Share this post


Link to post

With the upgrade to version 13, I also felt like I had paid for a tire change at a car repair shop, and they took my spare tire without asking.

  • Haha 3

Share this post


Link to post

I cannot get the idea: they introduced LSP, which actually should serve as a base for things like refactoring and code navigation. And now they claim that no built-in refactoring will be available any more. These two things logically contradict each other.

Share this post


Link to post
38 minutes ago, balabuev said:

no built-in refactoring will be available any more

Not completely. Read this blog and scroll to the very last comment from Ian Barker where he says:

Quote

We do intend to bring back formatting

It's a surprising and painful, but temporary, omission.

Share this post


Link to post
42 minutes ago, corneliusdavid said:

We do intend to bring back formatting

Imho, almost no one need formatting. Everyone needs refactoring. Most usefull: variable declaration (Ctrl+Shift+V) and renaming (Ctrl+Shift+E). And also, search for usage (Ctrl+Shift+Enter).

 

  • Like 1

Share this post


Link to post
2 minutes ago, balabuev said:

Imho, almost no one need formatting. Everyone needs refactoring.

For me, it's just the opposite. I often inherit ugly code that is hard to read and formatting is invaluable.

 

I haven't used refactoring all that often in the past; it can save a little time here and there but I don't remember all the different hot keys. However, since Delphi 13 came out and I installed MMX Code (which is actually better than the refactoring features built-in to D12), I'm starting to use it more often and seeing how useful it could be if I put my mind to it.

  • Like 2

Share this post


Link to post

Well, if Delphi is positioned by Embarcadero as a tool for reading old ugly code, then yes, may be formatting is needed more (but it still not depend on LSP). On the other hand if Delphi is claimed alive, that is, suited for developing new software, then mentioned refactoring features - are must have.

 

Not all refactoring features are usefull, however. Extracting method for example, was ugly and unusable from the beginning - so no need to be supported. But, renaming things and declaring local variables - should be supported (and based on LSP, not on third party parsers).

 

Finding all references tool is not a refactoring tool at all, while it's very critical for analyzing old code and, as well, for developing new code. Moreover, by nature, it should be based on LSP. And it still was killed by Embarcadero. Shame as always!

 

  • Like 2

Share this post


Link to post
51 minutes ago, balabuev said:

Not all refactoring features are usefull, however. Extracting method for example, was ugly and unusable from the beginning - so no need to be supported. But, renaming things and declaring local variables - should be supported (and based on LSP, not on third party parsers).

Guess what, some people think different. For me, the (GExperts) formatter is very important as I don't want to format (mostly indent) code by hand any more. But also, I found the extract method refactoring useful and of course the declare variable and rename identifier refactorings.

Edited by dummzeuch
  • Like 1

Share this post


Link to post

The folks at Embarcadero have declared the refactoring and formatting parts of the IDE as deprecated for version 11 (was it?) and it was just a matter of time before it got the boot, being old .net code and a foreign body altogether. Which is wise in itself.

The decision to do so without providing a replacement out-of-the-box and even letting corresponding Menu items disabled in stead of invisible however has been a poor choice, that leaves customers question aforementioned wisdom.

I myself am really torn between "way to go" and "OMG" at this. I rarely used refactoring, but mostly because it really took forever to even open up the menu, so I have been avoiding it, actually. And my formatting needs are fulfilled be the fine GExperts.

Share this post


Link to post

Using formatting to indent my own code seems to me veeeery strange idea :). As about old obsolete .Net based refactoring code in Delphi - I agree, it need to be replaced. With new native LSP based.

Share this post


Link to post
45 minutes ago, Sherlock said:

letting corresponding Menu items disabled in stead of invisible

I guess it is for consistence with C++ Builder, where refactoring is done by a different package than the Delphi part.

 

Actually, I asked how to rewire the Refactoring menu items to the corresponding MMX actions, but the available interfaces don't support that - yet.

Share this post


Link to post
7 hours ago, balabuev said:

Well, if Delphi is positioned by Embarcadero as a tool for reading old ugly code

This is a very strange statement. Delphi isn't "positioned" to read old ugly code, it's purpose is to read and compile Pascal code. Pascal, in its definition, does not require any style of indentation; in fact, the code here can be compiled. "Readableness" is in the eye of the beholder; what looks good to one programmer may look horrible to another. I've inherited code where all the begin's and end's were indented to the same level as the code body and it was difficult for me to "see" logic blocks because I'm so used to looking for "standard" indentation styles. After applying my formatting rules, I was able to scan code much more quickly.

7 hours ago, balabuev said:

Not all refactoring features are useful, however. Extracting method for example, was ugly and unusable from the beginning - so no need to be supported. But, renaming things and declaring local variables - should be supported.

You make a lot of statements that you assume applies to everyone. Like @dummzeuch said, "some people think different." I have found the extract method to be one of the most useful refactoring tools. For example, as I'm writing a procedure, I think it will be relatively short, so I put everything I need right there; then as I add more, I realize it should've been broken up into parts. That's where the extract refactor is quite handy as it moves associated variables, declares the new method, and adds the call in the original code. That saves a lot more time than renaming a variable name (ever heard of search-and-replace?) or declaring a variable (create a quick bookmark, jump to a declaration area, create the variable, then jump back to the bookmark).

 

Everyone works a little differently and has different experiences. 

  • Like 1

Share this post


Link to post
4 hours ago, balabuev said:

Using formatting to indent my own code seems to me veeeery strange idea :).

But you do see the value of a formatter in this case, don't you:

if SomeCondition then
  doOneThing;
  doAnotherThing;
doMoreStuff;

I have been bitten by this enough times that I no longer rely on my own manual formatting.

On top of that I'm lazy.

  • Like 3

Share this post


Link to post

I love the formatter for finding missing ";" or weeding out invisible characters that confuse the compiler.

Share this post


Link to post
On 10/23/2025 at 6:19 PM, balabuev said:

Imho, almost no one need formatting. Everyone needs refactoring. Most usefull: variable declaration (Ctrl+Shift+V) and renaming (Ctrl+Shift+E). And also, search for usage (Ctrl+Shift+Enter).

 

For solo projects sure but any project with two or more devs in the same codebase gets to be a diff nightmare without the same formatting profile. Guess we're holding off for the .1 or .2 per usual.

  • Like 1

Share this post


Link to post
On 10/30/2025 at 5:28 PM, H05 said:

For solo projects sure but any project with two or more devs in the same codebase gets to be a diff nightmare without the same formatting profile.

Here I would agree, this seems reasonable to me.

 

On 10/24/2025 at 6:41 PM, dummzeuch said:

 


if SomeCondition then
  doOneThing;
  doAnotherThing;
doMoreStuff;

 

If I ever make such a mistake, with 99.9% it will mean this:

if SomeCondition then
begin
  doOneThing;
  doAnotherThing;
end;
doMoreStuff;

And not this:

if SomeCondition then
  doOneThing;
doAnotherThing;
doMoreStuff;

Anyway, generally I'm not against formatting as a feature of IDE. Just my topic is not about it. 

 

Features, I mentioned, like identifier renaming and search for all identifier usages was so natural features of IDE, like find/replace, bookmarks, class completion,  or navigating between interface and implementation via Shift+Ctrl+Up/Down. Al these features are mentally reside in a single list of everyday "must have" features of the IDE. So, I'm very sad and disappointed with the latest Delphi 13 release, moreover LSP based features continues to work unstable!

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×