Disable code check for conditional compiling

I have an AS3 project which runs both on mobile devices and on the web. They share the same code base and to deal with the Air vs web SDK differences, conditional compilation is being used. The problem is that when opening the web version, IntelliJ starts complaining about Air functionality not being found, even though the project compiles without any problems. To "solve" this, I created mock objects simply to get rid of the red squigly lines throughout my code.

IntelliJ is smart enough to pull the compiler constants from my build configuration and provide code hinting for them. But if a value is false, it will still check the code within the block for errors. Is it possible to have IntelliJ take into account the value? Or what would a better solution be for my problem?

2 comments
Comment actions Permalink

I guess you have several Flash build configurations for the Flash module: one with Mobile target platform, the other one targeting Web (build configurations are subnodes of module node in Project Structure | Modules | [your Flash module]). You may switch which build configuration should be used for code highlighting: there's corresponding widget in the IDE status bar (and also in the context menu - 'Active build configuration').
Unfortunately there's no such feature as ignoring code surrounded with conditional compiler definition that evaluates to false.

0
Comment actions Permalink

Thanks for the quick response.
The setup is slightly different (two different projects with a shared repository), but the gist of it is the same. Unfortunately it sounds as though there isn't a decent solution. It's either mock objects, or adding Air as a dependency to the web project and then not using it when compiling (or getDefinitionByName, but that's dirty and breaks all code hinting if I don't cast afterwards).

0

Please sign in to leave a comment.