AppCode 2019.3 Help

Configure code style

If certain coding guidelines exist in a company, one has to follow these guidelines when creating source code. AppCode helps you maintain the required code style.

Code styles are defined at the project level and at the IDE level (global).

  • At the project level, settings are grouped under the Project scheme, which is predefined and is marked in bold. The Project style scheme is applied to the current project only.

    You can copy the Project scheme to the IDE level, using the Copy to IDE command.

  • At the IDE level, settings are grouped under the predefined Default scheme (marked in bold), and any other scheme created by the user by the Duplicate command (marked as plain text). Global settings are used when the user doesn't want to keep code style settings with the project and share them.

    You can copy the IDE scheme to the current project, using the Copy to Project command.

Configure code style for a language

  1. In the Preferences dialog ⌘,, go to Editor | Code Style and open the page of your programming language.

  2. Choose the code style scheme to be used as the base for your custom coding style for the selected language.

  3. Browse through the tabs of the selected language page, and configure code style preferences for it.

Copy code style settings from other languages

For most of the supported languages, you can copy code style settings from other languages or frameworks.

  1. In the Preferences dialog ⌘,, go to Editor | Code Style and open the page of your programming language.

  2. From the list that appears, select the language to copy the code style from.

    Set code style

Use code style settings from predefined guidelines

For C/C++, you can copy settings from the predefined code styles. Note, that each predefined code style affects only the certain items of base settings and leaves the rest unchanged.

  1. In the Preferences dialog ⌘,, go to Editor | Code Style | C/C++/Objective-C.

  2. Select the link Set from in the upper-right corner and select Predefined style option from the list.

  3. In the list that appears, select the code style to copy settings from:

    Using code style settings from predefined guidelines

Create a copy of code style settings

You can define the code styles that differ from the pre-defined ones. These code style schemes are stored in XML files, in the config/codestyles folder under the user home directory. You can use the created copy for modifying code styles, and for export.

If you select a code style scheme other than Project, then this code style will be saved for a project. Thus you can assign a global (IDE) code style for each project.

  1. In the Preferences dialog ⌘,, go to Editor | Code Style.

  2. Select the desired scheme from the Scheme list and click the Scheme Settings icon.

  3. Select one of the following options:

    • Copy to IDE - select this option to store the selected scheme in a global level.

      AppCode saves the new code style with the specified name in the config/codestyles/<code_style_name>.xml file under the AppCode home directory.

    • Copy to Project - select this option to store the selected scheme in a project level.

      The selected code style is saved in the .idea directory in the file codeStyleSettings.xml.

    • Duplicate - select this option to make a copy of the selected scheme and store it in the same level.

  4. In the Scheme field, type the name of the new scheme and press to save the changes.

Manage code style schemes

  1. In the Code Style page, select the desired scheme and click manage profiles.

  2. Select one of the following options:

    • Rename - select this option to change the name of the selected scheme.

    • Export - select this option to export your code style settings to the desired location.

    • Import - select this option to import AppCode XML code style settings, JSCS config file, or Eclipse XML Profile.

  3. In the Scheme field, type the name of the new scheme and press to save the changes.

Last modified: 31 March 2020