6 Replies Latest reply: May 11, 2012 4:43 AM by Sameer Bhatt RSS

    Coding aids are broken - no auto import

    matteosistisette

      I've started using Flash Builder and I'm astonished at seing that such an IDE lacks a very basic coding aid feature that even Flash Professional has: automatically added import statements.

       

      In Flash Professional, if I write "new ActivityEvent", it automatically recognizes this as a known class, it gives me hints, and it automatically adds an import statement for it at the beginning of the file.

       

      However, Flash Builder does not. It shows a warning that this is an unknown type until I manually add the import statement, then it recognizes it and gives me the hints.

       

      This is ridiculous, and especially in an IDE which is based on Eclipse (in original Eclipse, if you write the name of a class which exists somewhere but you have not imported, you right click and have the option to choose which existing class definition to import or whether to create a new one).....

       

      Is there some setting that doesn't have the proper default value and that I can change, is there any workaround, or is this so basic feature just lacking?

       

      Most other coding aid features do work btw

       

      thanks

      m.

        • 1. Re: Coding aids are broken - no auto import
          matteosistisette Community Member

          forgot to mention, it's Flash Builder 4.6

          • 2. Re: Coding aids are broken - no auto import
            Guriya Kalyani Community Member

            Hi,

            Flash Builder 4.6 does have the auto import feature.

            When say typing, 'new Butt <invoke Code hints> ' , selecting the same ideally will auto import your class.

             

            Can you post the sample code where it doesn't work or steps to reproduce the same?

            Thanks.

            • 3. Re: Coding aids are broken - no auto import
              matteosistisette Community Member

              Sometimes it works, sometimes it doesn't. It looks completely random, or there may be some pattern behind it that I don't get, in any case it should ALWAYS work.

               

              For example I type:

               

              public function myEventHandler(e:Te

               

              when I'm typing "Te" it should suggest me classes starting with Te, among which for example TextEvent, and when I choose TextEvent, it should automatically add the import statement.

              This doesn't always happen. Often code hints don't appear and if I write the whole class name manually it is not autoimported (and is marked as error until I import it).

               

              I've tried it now and it is working. Other times it doesn't.

               

              What do you mean by <invoke code hints>? Code hints usually appear automatically.

               

              Another thing that is broken is that the code hints that do always work, don't appear if you type too fast.

               

              E.g.

              var s:String;

               

              Usually, as soon as you have typed "var s:", hints appear, so that when you type Str you are already being suggested String and you can hit Enter

              However, if you type too fast and you don't wait enough milliseconds between typing the ":" and typing the "S", then hints don't appear, and then they don't appear any more. You have to backspace until you delete the colon, type it again and wait a fraction of a second for the hints to appear. This is wrong.

              • 4. Re: Coding aids are broken - no auto import
                Sameer Bhatt Adobe Employee

                Hello,

                 

                <invoke code hints> means that you can explicitly invoke code-hints by pressing Ctrl + Space.

                By default, there is a slight delay (of 200ms) before code-hints appears automatically. So, if you type really fast, code-hints may not appear automatically. However, you can change the delay by changing the value of 'Activate after' in Window -> Preferences -> Flash Builder -> Editors Page

                 

                You might also want to try enabling 'Use additional custom triggers' checkbox in the same preference page. By enabling this, you don't need to invoke code-hints by pressing Ctrl + Space. Relevant code-hints will automatically appear on every character you type.

                 

                I think the random behavior you are observing while typing and not getting the hints automatically may be attributed to the delay that I mentioned above.

                 

                And, in var s:Str case, you can simply press Ctrl + Space rather than hitting backspace and typing colon again. But if you make the delay as 0 ms and enable 'Use additional custom triggers', this condition will not arise.

                 

                Thanks,

                Sameer

                • 5. Re: Coding aids are broken - no auto import
                  matteosistisette Community Member

                  Ok I see. I didn't know the delay was by design.

                   

                  Regarding this:

                   

                  I think the random behavior you are observing while typing and not getting the hints automatically may be attributed to the delay that I mentioned above.

                  No, that's not the case. When it refuses to work it does even if I wait a minute after typing ":"

                  Next time it happens, I will try by invoking the hints explicitly abd see if that works.

                  • 6. Re: Coding aids are broken - no auto import
                    Sameer Bhatt Adobe Employee

                    No, that's not the case. When it refuses to work it does even if I wait a minute after typing ":"

                    Next time it happens, I will try by invoking the hints explicitly abd see if that works.

                     

                    Also, when it happens next time, it would be great if you could share the file you are working on so that we can try and find the problem you are facing.

                    If you can't share the file on the forums, please let me know and I will share my e-mail id with you.