Jason
Jason

Reputation: 1309

Declaring functions / variables automatically

Is it possible to declare functions or variables automatically in Webstorm? I have following code

switch(VAL){
  case 0:
    FUNC1();   //undeclared
    FUNC2()    //undeclared
    break;
  case 1:
   .... many more ..
}

When I hover over on each function, it says

Unresolved function or method FUNC1()..

I want to figure out a way to declare functions in following pattern

function FUNC1(){

}

function FUNC2(){

}

Thanks in advance.

Upvotes: 1

Views: 183

Answers (1)

Mchl
Mchl

Reputation: 62377

Try pressing Alt+Enter when your cursor is inside undeclared function call, and you will get a list of possible actions, among them declaring the new function as local/global etc.

enter image description here

Upvotes: 4

Related Questions