JetBrains Fleet 1.43 Help

Format code

This topic covers how to use and set up the code formatting features in JetBrains Fleet.

File format/language

When you are working on a file, JetBrains Fleet automatically detects its format, which determines the behavior of the code intelligence features.

File format menu in the bottom-left corner of the editor

If the detected format is not what you want, you can specify file format manually.

Set file format

  • In the bottom-left corner of the screen, click the file format menu, then select a language.

    File format menu suggesting available languages

Indent on line break

Whenever you put a line break, JetBrains Fleet starts the new line with the correct indentation. This feature is enabled by default.

Disable auto-indenter

  1. In the Preferences menu, uncheck Editor: Code | Auto indent on Enter.

  2. Alternatively, add the following line to your settings.json file:

    "enableIndenter": false

Reformat file

Whenever you want JetBrains Fleet to format the current file, use the ⌥ ⇧ F shortcut. Also, you can find this action in the Actions popup ⌘ ⇧ K:

Searching for Reformat Code action using the Go to popup

Formatting rules

JetBrains Fleet determines the formatting rules based on the EditorConfig and IntelliJ configuration files present in the workspace.

EditorConfig

JetBrains Fleet allows you to manage all code style settings for each individual set of files with EditorConfig support.

EditorConfig is a widely-recognized standard for describing the code formatting rules. It allows for easy syncing of the code formatting settings between team members and different instances of the code editor.

Along with standard EditorConfig properties, JetBrains Fleet works with those specific to IntelliJ-based IDEs. Some of IntelliJ keys require Smart Mode.

Apply EditorConfig

  • To apply formatting rules to a particular folder, place the .editorconfig file in it. Rules are resolved top-down, which means that rules for a subfolder will override the settings that apply for its parent folder.

  • To create global rules, place the .editorconfig file in the root folder where all your projects reside. This will apply the formatting for all the projects within the folder.

Last modified: 21 May 2024