Hi friends!


Hi friends!

I've always used and I like the Delphi auto-formatter feature to realign my code. I know some dislike that but me I like it. It makes code aligned fine, uniform and constant and I am happy with that.

BUT sometimes I would like the formatter to ignore a section. For example, some section with tables where I intentionnally include spaces to keep things aligned like image attached.

But when I will reformat this, I will lose all these aligments I did.

My question is "Is there a way to type something that will instruct the formatter to ignore that section?" I've seen other program editor like NetBeans where we can add stuff like "// " and it instructs the editor to collapse the section between these delimiters.

May we have the same with the Delphi Editor to avoid auto-formatting on a section? Something like:
//
My        code        with        spaces        anywhere    
//


Please, don't answer me to don't do auto-formatting because I like more the other advantages it gave me than this annoying thing... And also, I don't wish to have for exampe my tables in another file and do a {$INCLUDE... }. I already tried but it's annoying to have spread things like that everywhere...

Maybe I am asking too much! :-)

Dennis.

Comments

  1. The formatters in GExperts and CnPack both support flagging sections to prevent formatting in certain areas. To mark the beginning of such an area, you type in {(} and for the end, {)}. Very nice.

    Update: Google plus intercepts the sequences. The first should be { ( * } and the second { * ) }, but without the spaces.

    ReplyDelete
  2. Bill Meyer Hoping a miracle I tried it in Delphi 10 Seattle but... No surprise, it did not work. :-( But thanks for mentionning it exists somewhere else. I feel less alone. :-)

    ReplyDelete
  3. Denis Bisson Tried in what? GExperts or CnPack? For GExperts, the formatter is maintained by +Thomas Mueller (dummzeuch), and I do not know whether he has resolved possible issues with Seattle. If you used CnPack, I do not know whether it will work properly in Seattle.

    In GExperts, the character sequences for preventing formatting are settable. In the formatter configuration, see the Misc page of the dialog.

    ReplyDelete
  4. Yes, that's what I was hoping that was already present... I added my vote. One vote won't change the world but it cost nothing. :-)

    ReplyDelete
  5. Denis Bisson It cost nothing, and will likely accomplish the same.

    ReplyDelete
  6. Bill Meyer
    I meant that I tried in Delphi editor, that's was I meant by "hoping a miracle...". Ha! Ha!

    I took the time to download, install and tried GExperts. I was about to replied you that there is no code formatter there except a few kind of action on selected lines... But I remembered you wrote the name of +Thomas Mueller and went to his site and realize it was a kind of non-official add-on. I gave it a try. At first look it seems to have less options than in Delphi... BUT it has the feature of to define blocks for non-reformat AND another thing I was not able to configure to my wish with Delphi. SO I will give it a try to that tool in the next days.

    THANK YOU VERY MUCH for your answer. It was not a live-or-die problem for me but... it's something I like. Code formatting make my eyes happy!

    Dennis.

    ReplyDelete

Post a Comment