cnwizards icon indicating copy to clipboard operation
cnwizards copied to clipboard

[Code Formatter] Cant format

Open rareMaxim opened this issue 7 years ago • 2 comments

CnFormatter cant format this code:

  LBot := TTelegramBot.Create('YOUR_TOKEN',
                              {$IFDEF  USE_INDY_CORE}
                                TcuHttpClientIndy.Create(nil)
                              {$ELSE}
                                TcuHttpClientSysNet.Create(nil)
                              {$ENDIF});

rareMaxim avatar May 16 '18 05:05 rareMaxim

Default we treat compiler directives as comments, so the code piece leads to an error parsing according to Pascal grammar.

You can change the "compiler directive" option in Code Formatter Setting Dialog to "Only First" block and try it again?

shanzhashu avatar May 18 '18 03:05 shanzhashu

cnPack 1.1.8.983 Failed formatting code (showing error dialog):

type

{$DEFINE TEST}

  {$IFDEF TEST}
  TMyStrings = class(TStrings)
  {$ELSE}
  TMyStrings = class(TStringList)
  {$ENDIF}
    public

  end; // of: TTestClass

pult avatar Aug 13 '19 15:08 pult