Search code examples
eclipsekeyboard-shortcutswebstorm

How to jump to the next parameter / end of statement in Webstorm?


I'm coming from an Eclipse background.

In Eclipse if you for example start to type a method invocation:

myObject.someMethod

Eclipse prefills the parameters like this:

myObject.someMethod(param1, param2)

and selects the first parameter. When you finished editing it you can press Enter to jump to the next param and after the last parameter pressing Enter works like I've pressed Home and jumps to the end of the statement.

How can I achieve the same behavior in Webstorm? I'm really used to this feature so I miss it here. I tried the "Smart keys" but that feature is not that smart.


Solution

  • There is something similar in WebStorm, but it does not work exactly like Eclipse. In your example, you'd type

    myObject.someMet
    

    (or enough for WebStorm to find your function name) then hit Ctrl + space. You would then see:

    myObject.someMethod()
    

    and your cursor will be in the parentheses.

    You can then type the first parameter and when WebStorm has a suggestion you want to accept, you can accept it by hitting comma. WebStorm inserts your parameter value, and the comma following it. So this results in:

    myObject.someMethod(param1, )
    

    with your cursor in the right place to start typing your param2 value.

    Incidentally, I found that the Productivity Guide (under the help menu) is a great way to find these sort of gems that you might be missing out on. Was really helpful when I switched from Eclipse to IntelliJ.