GoLand 2023.3 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 go to Code | Rearrange Code in the main menu.

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: 18 January 2024