GoLand 2023.2 Help

Rearrange code

Configure arrangement rules

You can rearrange your code according to the arrangement rules set in the Code Style page of the Settings dialog.

Matching rules example

Rearrange code

  1. Press Control+Alt+S to open the IDE settings and then select Editor | Code Style.

  2. In the editor, select the code entries you want to rearrange and from the main menu, select Code | Rearrange Code.

Automatically rearrange code on save

You can configure the IDE to rearrange code elements in modified files automatically when your changes are saved.

  1. Press Control+Alt+S to open the IDE settings and then select Tools | Actions on Save.

  2. Enable the Rearrange code option.

    Additionally, you can click Configure arrangement rules to specify the rules for reordering code elements for the selected language.

Last modified: 23 August 2023