Skip to content

Code Refactoring

Lorenzo Pichilli edited this page Feb 10, 2018 · 20 revisions

You could find refactor commands on the Main Menu under Tools > JavaScript Refactor, on the Context Menu and also on the Side Bar Menu. The last one will have only a subset of them.

Refactor Commands are:

Convert to arrow function

[Context Menu, Main Menu]

Converts a function expression to an arrow function. Put your cursor inside a function expression and then execute the command.

From:

setInterval(function () {

}, 1000)

To:

setInterval(() => {

}, 1000)

Export

[Context Menu, Main Menu] [Preview Available]

Exports a function, class or variable to another file and then import it in the current one.

Function

Put your cursor inside a function expression and then execute the command. You will see a new view opening to the right (see WindowView) where you could type in the destination path of the new file and also see the preview.

If you choose an existing path, then you will be prompt for a confirm to append the exported function to the chosen file.

Change destination path:

See the preview:

You could also use the Folder Explorer to navigate through your folders:

Final result:

Clone this wiki locally