2 Replies Latest reply on Jun 15, 2010 11:43 AM by Adam Cameron.

    Auto-complete inserting spurious function calls

    Adam Cameron. Level 5

      G'day

      This has happened often enough for me to now be annoyed by it.

       

      Consider this code:

       

      <cfscript>

           variables.myStruct = {

           };

      </cfscript>

       

      When entering this in CFB, it auto-completes like this (in stages, as indicated):

       

      <cfscript>[ENTER]

      [CTRL-SPACE][select /cfscript> from the dropdown]

       

      The first thing to note here - unrelated to the subject line of this topic - is that the </cfscript> doesn't automatically get inserted, despite the fact I have the "When typing '>' of start tag" option selected for the "Auto-close tags" option.  So that's a fail right there.

       

      Next I type in:

       

      <cfscript>

           variables.myStruct = {[ENTER]

           }

      </cfscript>

       

      The closing } inserts correctly, but however so does a abs() function call, so I'm left with this:

       

      <cfscript>

           variables.myStruct = {abs()}

      </cfscript>

       

      Rather than:

      <cfscript>

           variables.myStruct = {

           }

      </cfscript>

       

      Which is what I'd expect.

       

      This happens as often as I care to replicate it.

       

      I understand why it's happening: CFB is deciding to be "helpful" and thinking that I must be wanting a function call next, and displays the list of functions as I am typing my [ENTER], and abs() is the first function on the list so the [ENTER] selects it.  However this is based on false logic: there is no circumstance under which I would want a function call at this point (because the next thing I would be typing would be a struct key name).  Function calls would only (usually) appear on the RHS of an expression, IE: after an equals sign.  So to trigger this function-list dropdown here is plain wrong.  And even if it was appropriate at where I was in my code, CFB should give me chance for what I type to be construed as an [ENTER], rather than a selection from a dropdown.

       

      Whilst troubleshooting this, I came across a weird thing.  I was wondering whether the "Delay before showing code assist" would impact this, so bumped it from the default of 500ms out to 5sec, just to see what happened.  This solved the problem.  Even after 5sec, the function dropdown did not appear.  Then I put it back to 1sec... still no dropdown at any stage.  Then I put it back to 500ms (the original value): still no dropdown.  So it seems that setting that value also affected something else which stopped the function list dropdown from appearing.  That sounds a bit random to me.  Note: yes I am restarting CFB between each change of that setting.

       

      The 500ms is a bit of a red herring too.  My typing speed when I'm just "going with the flow" is about 80-100wpm, and perhaps the first time I typed the code in there might have been 500ms between the } and the [enter], but when I came to replicate it I would think there was perhaps 100-200ms between those keystrokes.  Obviously it's difficult to measure 100-200ms by gut instinct alone, but 500ms is long enough to be a tangible period of time, and it certainly was not 500ms between keystrokes.  Basically the dropdown was appearing immediately after the } was pressed.

       

      Has anyone else experienced anything like this?

       

      My install is CFB Version: 1.0.0 Build: 274227, installed stand-alone on Win Vista Home Premium, 64-bit.

       

      --

      Adam

        • 1. Re: Auto-complete inserting spurious function calls
          Dipanwita S Level 1

          Hi Adam,

           

          I tried reproducing this issue but did not see the auto-insert of the first function. Content assist does bring up the function list after the { Enter, but it does not auto-insert the first function in there. An 'Esc' lets you type ahead without any default insertion. I am on the CFB Updater build. Two consecutive 'Enter' in the same place would insert the first selected function.

           

          We understand the need for more intelligence in the code insight and are working on it. Irrespective of that, auto popup of code insight might be an annoyance for  many users, hence we provided the option to turn it off and invoke it only on demand.

           

          Thanks,

          Dipanwita

          Adobe ColdFusion Builder Team

          1 person found this helpful
          • 2. Re: Auto-complete inserting spurious function calls
            Adam Cameron. Level 5

            There is no autoinsert going on.  I didn't suggest that there was.  The function is inserted by the ENTER (as per my explanation above), the problem is that the function-select dropdown is appearing immediately after I press {, so the ENTER keystroke I type immediately after it is selecting the function from this blimin' list that's popped up, rather than being the CR/LF I actually want it to be.

             

            I realise I can press ESC to dismiss the list, the point is I shouldn't have to dismiss the list because it shouldn't be showing up in the first place (until after half a second pause).  I am not pausing for half a second after the "{": I'm not pausing at all.  I speculate it would take maybe two sec to type all of

             

            variables.myStruct = {[ENTER]

            }

             

            (from my example above), so the gap between each keystroke is gonna be around 80ms (incl. both keystroke and pause between the keystrokes).  Even if I am over-estimating my typing speed by a factor of five... that's still not enough time for the menu to have appeared as I typed continuously without pause.

             

            Equally I'm typing faster than I can react to "oh that bloody dropdown has appeared, quick, press ESC to get rid", so it's not really a viable remedial suggestion.

             

            --

            Adam