Jump to content
A.M. Hoornweg

Delphi 12 IDE, auto-formatter mutilates generics

Recommended Posts

Hello all,

 

I see that the Delphi 12 source code formatter (Ctrl-D) still mutilates generic class declarations, it inserts inappropriate line feeds between keywords and ruins indentation.

Is there a way to set markers in the source code that tell the formatter to skip those areas from formatting? Or can you recommend a better code formatter that handles generics properly?

 

 

Have a nice day!

Arthur

  

 

 

 

 

 

 

before_formatting.thumb.png.749f19a7b6ea9f5dddad8e601baf7fb5.pngafter_formatting.thumb.png.38eba439af27f81b35394ab766a05265.png

Share this post


Link to post

Yeah, the formatter is no longer maintained, marked as deprecated and should be handled with caution.

Aside from that, you may highlight a specific code section and format only that. Or you could go a different way and choose to use the GExperts code formatter. It knows source directives to prevent code formatting.

Share this post


Link to post

Do not try the formatter in source where you've multiline string. They should deprecate also the IDE editor it can't cope with the code. I've a section in my code that I cannot edit inside the IDE (a class with inner types).

Edited by Lajos Juhász

Share this post


Link to post
19 minutes ago, Sherlock said:

Or you could go a different way and choose to use the GExperts code formatter. It knows source directives to prevent code formatting.

And also, in the most recent source code (no release yet, maybe this weekend, but no promises), it supports multiline strings.

  • Thanks 1

Share this post


Link to post
2 hours ago, Sherlock said:

Yeah, the formatter is no longer maintained, marked as deprecated and should be handled with caution.

Aside from that, you may highlight a specific code section and format only that. Or you could go a different way and choose to use the GExperts code formatter. It knows source directives to prevent code formatting.

Eh what, the internal IDE source code formatter is deprecated? Are they just abandoning it without any replacement? I find it rather essential. 

  • Like 3

Share this post


Link to post

They found - what everyone else claimed for a long time - that it didn't keep up with the latest language enhancements. As it is based on other deprecated parts (i.e. Refactoring), they consequently marked it deprecated, too. Now they are working on or looking for replacements.

 

Communicating that something is deprecated without having an alternative at hand is not necessarily a bad thing. People now know it advance what they can expect and rely on and what not.

  • Like 1

Share this post


Link to post
4 hours ago, Sherlock said:

I'm sure they're working on it for Delphi 13 codename "Salem".

Please don't spread fake news.  There is no such version.

4 hours ago, Sherlock said:

But for now https://docwiki.embarcadero.com/RADStudio/Athens/en/What's_New#Moving_Deprecated_Features and because the formatter is not explicitly mentioned here, it's deprecated through the modeling support.

It is explicitly mentioned, in a roundabout way:

Quote

In RAD Studio 12.0 Athens, we are moving some old and unsupported tools out of the core product installation, making them available as add-ons:

  • VCL Translation Support.
  • Modeling. Note that you must install this if you want to use Delphi code formatting, and it is available in the Technology section of the installer.

Modeling is deprecated, and the current code formatter depends on it, so the formatter is also deprecated.

Share this post


Link to post
1 hour ago, gkobler said:

Is there an alternative for the code formatter?

Write properly formatted code in the first place? :classic_dry: (gdr)

Share this post


Link to post
5 hours ago, PeterBelow said:

Write properly formatted code in the first place?

I'm just lazy and like to leave the work to the formatter 

Share this post


Link to post
On 12/15/2023 at 7:04 PM, Remy Lebeau said:

Please don't spread fake news.  There is no such version.

Sorry about that, that was just my humorous side getting the better of me, I know there will be no Version 13 - but if there ever was, it would aptly be named after a town with a "witch problem". :classic_biggrin:

  • Haha 1

Share this post


Link to post
7 hours ago, Sherlock said:

Sorry about that, that was just my humorous side getting the better of me, I know there will be no Version 13 - but if there ever was, it would aptly be named after a town with a "witch problem". :classic_biggrin:

Ah! Stupid me, that joke went right over my head, I didn't even notice the 13 🤯

  • Like 1

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

×