Trouble with Flex 4 code completion / error highlighting.

Hi,

I'm having some trouble with Flex code completion and error highlighting using IDEA v9.0.1 (93.94).  I stripped a Flex module down to almost nothing and took the attached screenshot.  IDEA code completion suggests s:Box and other options that aren't valid.  If I choose (for example) s:Box from the code completion drop down, the editor will show 'all green' (no errors).  I then have to re-import all Maven modules before it will correctly hightlight s:Box as an error.

I'm using Flex 4 (build 13555) and Flexmojos 3.4.  Here is a POM snippet of dependencies in case it's useful:

     <dependencies>
          <dependency>
               <groupId>com.adobe.flex.framework</groupId>
               <artifactId>flex-framework</artifactId>
               <type>pom</type>
          </dependency>

          <dependency>
               <groupId>com.adobe.flex.framework</groupId>
               <artifactId>playerglobal</artifactId>
               <type>swc</type>
               <classifier>${playerGlobalClassifier}</classifier>
          </dependency>
     </dependencies>


I'm also having trouble with fx:Script tags inside of s:Application.  See the second screenshot I've attached to see what I mean.



Attachment(s):
FlexInspectionProblem2.png
FlexInspectionProblem.png
3 comments
Comment actions Permalink

Please make sure that /target/...-config-report.xml file exists and /target/classes/config-4.0.0.13555/ folder exists and contains a bunch of config files. These files are copied there during compilation by maven. If that's ok, then closing/opening IDEA's project may help.

0
Comment actions Permalink

Thanks for the reply.  I have both of those.  The config directory is actually /target/classes/config-4.0.0.13555/ which I assume is correct.  I think I'm experiencing 2 different problems.  First, I have two profiles that I toggle between to build my project using either BlazeDS or GraniteDS.  Both build my artifacts with classifiers which IDEA seems to ignore.  My POM uses:

<plugin>
     <groupId>org.sonatype.flexmojos</groupId>
     <artifactId>flexmojos-maven-plugin</artifactId>

     <configuration>
          <classifier>${ds-classifier}</classifier>
     </configuration>
</plugin>


Artifacts and my configuration report files are something like:

flex-core-1.0-SNAPSHOT-blazeds.swc
flex-core-1.0-SNAPSHOT-blazeds-config-report.xml


However, the facets in my project are trying to use:

flex-core-1.0-SNAPSHOT-config-report.xml


Besides that IDEA actually deals with my profiles amazingly well (including adding / removing modules when I toggle between profiles).

Second, I'm having tons of problems with flex-framework 4.0.0.13555.  My .mxml files declare namespaces like this:

<?xml version="1.0"?>
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
         xmlns:s="library://ns.adobe.com/flex/spark"
         xmlns:mx="library://ns.adobe.com/flex/halo">


As soon as I try to use anything in the mx: namespace my project fails to compile (so it's not a problem with IDEA).  For code completion IDEA acts as if all the components are dumped into the s: namespace.  Going back to flex-framework 4.0.0.12575 fixes all my issues except the fx:Script highlighting which I'm certain is a result of the first problem I described in this reply.

Below is a complete POM that uses the same structure as all of my Flex modules, but without any classifiers.  It's the POM I used to test between flex-framework versions (just in case it's useful to anyone that wants to try different versions of flex-framework):

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

     <modelVersion>4.0.0</modelVersion>

     <groupId>ca.my.group</groupId>
     <artifactId>flex-core</artifactId>
     <version>1.0-SNAPSHOT</version>
     <packaging>swc</packaging>

     <name>flex-core</name>

     <properties>
          <flexVersion>4.0.0.12575</flexVersion>
     </properties>

     <dependencies>
          <dependency>
               <groupId>com.adobe.flex.framework</groupId>
               <artifactId>flex-framework</artifactId>
               <version>${flexVersion}</version>
               <type>pom</type>

               <exclusions>
                    <exclusion>
                         <groupId>com.adobe.flex.framework</groupId>
                         <artifactId>playerglobal</artifactId>
                    </exclusion>
               </exclusions>
          </dependency>

          <dependency>
               <groupId>com.adobe.flex.framework</groupId>
               <artifactId>playerglobal</artifactId>
               <version>${flexVersion}</version>
               <type>swc</type>
               <classifier>10</classifier>
          </dependency>

          <dependency>
               <groupId>com.adobe.flex.framework</groupId>
               <artifactId>sparkskins</artifactId>
               <version>${flexVersion}</version>
               <type>swc</type>
               <scope>theme</scope>
          </dependency>
     </dependencies>

     <build>
          <sourceDirectory>src/main/flex</sourceDirectory>

          <plugins>
               <plugin>
                    <groupId>org.sonatype.flexmojos</groupId>
                    <artifactId>flexmojos-maven-plugin</artifactId>
                    <version>3.4.2</version>
                    <extensions>true</extensions>

                    <dependencies>
                         <dependency>
                              <groupId>com.adobe.flex</groupId>
                              <artifactId>compiler</artifactId>
                              <version>${flexVersion}</version>
                              <type>pom</type>
                         </dependency>
                    </dependencies>

                    <configuration>
                         <configurationReport>true</configurationReport>
                         <targetPlayer>10.0.0</targetPlayer>
                    </configuration>
               </plugin>
          </plugins>
     </build>
</project>

0
Comment actions Permalink

1. As for classifier for -config-report.xml file - this will be fixed in next IDEA EAP

2. Halo namespace is no more used in Flex 4. It was changed to library://ns.adobe.com/flex/mx . See http://opensource.adobe.com/wiki/display/flexsdk/Dropping+the+Fx+Prefix

0

Please sign in to leave a comment.