Search code examples
delphitms-web-coredelphi-12-athensdelphi-ide

How can I suppress ASM Block Errors in the Delphi IDE when using JavaScript in TMS WEB Core?


Almost every time I use an asm code block to write JavaScript, my IDE throws lots of errors and then the whole page starts bugging out such as code completion not working or component event creation not working properly, etc.

This is how it looks (Look at the red underlined words and the red error circles on the left):

Delphi ASM Block code in TMS WEB Core

The code works, it's just in design-time in the IDE that it thinks the code isn't working even though it works when I compile and run it.

Is there a way I can suppress these errors or tell the IDE that this isn't normal Delphi programming code and to ignore trying to read it?


Solution

  • You can wrap the asm block in a PAS2JS compiler directive (conditional define):

    {$IFDEF PAS2JS}
      asm
        // JavaScript code goes here...
      end;
    {$ENDIF}