-
Notifications
You must be signed in to change notification settings - Fork 39
Code Refactoring
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:
[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)
[Context Menu, Main Menu] [Preview Available]
Exports a function, class or variable to another file and then import it in the current one.
Put your cursor inside a function expression and then execute the command. You will see a new view opening to the right (see WindowView feature) 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. Instead, if you choose a new path, then the exported function will be the default export.
Change destination path:
See the preview:
You could also use the Folder Explorer feature to navigate through your folders:
Final result:
Put your cursor inside a class and then execute the command. You will see a new view opening to the right (see WindowView feature) 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 class to the chosen file. Instead, if you choose a new path, then the exported class will be the default export.
See Export Function for screenshots.
Put your cursor inside a variable and then execute the command. You will see a new view opening to the right (see WindowView feature) 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 variable to the chosen file.
See Export Function for screenshots.