3

In Eclipse with java, there is a special notation @formatter:off/on to disable/enable formatter from a section of source. Is there some similar feature in Delphi 2010? It's because anonymous procedures are ugly formatted:

begin
  Synchronize(procedure begin ShowMessage('Hi'); end);
end;
marciel.deg
  • 400
  • 3
  • 17
  • 4
    No, there is no way to disable sections of code from being formatted. – LU RD May 09 '17 at 20:51
  • 1
    Although it is not possible to disable the formatter for a section of source code, there might be solutions to the specific problem you have. Can you elaborate on that in more detail? – Uwe Raabe May 10 '17 at 06:42
  • While you can't disable formatting for a section, you can select a (different) section and only format that. If you want to format, just select the part _before_ the section, format, then the part _after_ the section and format again. More work, but I assume you don't have to reformat that often. In other words: formatting is not file-wise, you can also only format the current selection. – Rudy Velthuis May 10 '17 at 06:56
  • To get things straight: Do you mean formatting (like applying indentation based on `begin..end`, etc) or syntax highlighting (like highlighting keywords)? – René Hoffmann May 10 '17 at 08:17
  • You are not saying which version of Dephi you are using or which formatter. Assuming you use the one in GExperts (which might be unlikely but possible), there is {(*} and {*)}. – dummzeuch May 10 '17 at 10:29
  • 1
    Upgrade is the only alternative, unless you can find a plugin which does the job. See [Delphi automatic Format Source corrupts anonymous procedures](http://stackoverflow.com/q/15468331/576719) – LU RD May 11 '17 at 09:51
  • If I upgrade only the formatter dll from a newer Delphi version, it works? – marciel.deg Aug 15 '17 at 19:33

0 Answers0