WebStorm 10.0.0 Help

Inline

WebStorm provides the following inline refactorings:

  • The Inline Variable refactoring replaces redundant variable usage with its initializer. This refactoring is opposite to Extract Variable.
  • The Inline Function/Method refactoring results in placing the method's or function's body into the body of its caller(s); the method or function is deleted. This refactoring is opposite Extract Method.

Inline variable

    JavaScript example

    Before After
    Parenizor.method('toString', function () = '(' + this.getValue() + ')'; ing;
    Parenizor.method('toString', function () + this.getValue() + ')';

    Inline method or function

    Before After
    function sum(a, b){ ation(a, b){ a, b){ , b) / multiplication(a, b);
    function multiplication(a, b){ a, b){ / multiplication(a, b);

    To perform the inline refactoring

    1. Place the caret in the editor at the desired symbol to be inlined.
    2. Do one of the following:
      • On the main menu or on the context menu of the selection, choose Refactor | Inline.
      • Press Ctrl+Alt+N.
    3. In the Inline dialog box that corresponds to the selected symbol, confirm the inline refactoring.

    See Also

    Last modified: 31 March 2015
    comments powered by Disqus