Forum Discussion

earriaga's avatar
earriaga
Occasional Contributor
10 years ago

Code Completion does not display all available variables within the brackets.

Hello,

 

I am wondering if I am doing something wrong in where code completion won't show all available variables in the within the scope of the brackets. For example:

 

function LogMsg()

{

     var aStrg = "hello world"; // this local variable always shows up on code completion

     for(var i = 0; i <  3; i++)

     {

         Log.Message(aStrg );

         var  newStrg = "Goodbye";

         Log.Message(newStrg) ; // the newStrg variable won't show up on code completion as a option

     }

}

 

The only way I can get the variable 'newStrg' to show up on code completion is to move it to the beginning of the function. Is this how Test Complete expects you to define variables every time?   

 

 

6 Replies

  • Greetings...

     

    You mean as an option of what ?  it's a bit unclear...

     

    • earriaga's avatar
      earriaga
      Occasional Contributor

      The new varaible created within the scope of the for loop won't show up on completion code as an available local variable.   Only the variable that was created at the beginning the fuction will show up on code completion as an availabe variable. 

       

      *By code completion I mean the pop up box you get when pressed "CTLR+Space Bar" that shows all the objects & variables available within the scope of the function you are currently in*

       

       

       

      • rrivest's avatar
        rrivest
        Contributor

        ok... Variables have to be declared at the begining in order to be visible in CodeCompletion.

         

        Also... be carefull of lowerUpper if you have that condition checked in the project properties..