cnpack / cnwizards

CnPack IDE Wizards
http://www.cnpack.org
577 stars 140 forks source link

[Code Formatter] Cant format #71

Open rareMaxim opened 6 years ago

rareMaxim commented 6 years ago

CnFormatter cant format this code:

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

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?

pult commented 5 years ago

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