Reformat File dialog
Code | Reformat Code
CtrlAltShift0L
The dialog appears when you press CtrlAltShift0L in the editor of the current file. If you choose Code | Reformat Code from the main menu or press CtrlAlt0L, WebStorm tries to reformat the source code of the specified scope automatically.
For more information about reformatting, or excluding files from formatting, refer to Reformat and rearrange code.
Item | Description |
---|---|
Only changes uncommitted to VCS | If this checkbox is selected, then reformatting will apply only to the code that has been changed locally, but not yet checked in to the repository. This option is available only for the files under version control. |
Selected text | Choose this option to have the currently selected fragment of source code reformatted. |
Whole file | Choose this option to have all the source code in the current file reformatted. |
Options | |
Optimize imports | Select this checkbox to remove unused import statements from the code within the selected scope. |
Rearrange code | Select this checkbox to reorder your source code entries according to the configurations specified in the Arrangement tab of your Code Style settings. This checkbox is not available for Python files. |
Code cleanup | Select this option to run the code cleanup inspections. WebStorm finds and automatically fixes potentially problematic code fragments. |
Do not keep line breaks | Reformat line breaks according to the code style settings. This option overrides the Keep when reformatting | Line breaks setting. |
Run | Click this button to start reformatting the source code within the specified scope. |
tip
You can define rules and format your code as you write it. To define formatting rules for JavaScript, open the Settings dialog (CtrlAlt0S) and navigate to Editor | Code Style | JavaScript.
Thanks for your feedback!