AppCode 2017.3 Help


Shortcuts and settings

Show the error description ⌘F1
Navigate to next/previous error F2/⇧F2
Invoke Quick-Fix ⌥⏎
Run Inspection by name ⌥⇧⌘I
Configure highlighting level ⌥⇧⌘H
Preferences Preferences | Inspections


When writing a code sometimes you try to stop and think about your code’s beauty and accuracy. But it would be so much more comfortable if something assisted you with that on the fly. AppCode works this out! It strives for the code perfection and helps you to find places that smell and improve them just as you type. So here is a small dive into the Code Inspection mechanism.

The inspections work on the fly and highlight the potential problems (to show the error description use ⌘F1):

ac InspTutorial lighting

To navigate through the highlighted issues use F2 (to the next one) and ⇧F2 (to the previous one).
Moreover the mechanism suggests the quick fix (or several of them if possible) for an issue (you can see it by pressing ⌥⏎ after placing the cursor to the problematic code):

ac InspTutorial quick fixes 2x


If you feel this issue may appear in another scope in your project you can run inspection on it or even fix all the issues of this type at once. All of these and also the inspection settings are available in the context menu section:

ac InspTutorial inspections settings 2x
And what if you don’t consider this as an issue and don’t want the IDE to disturb you in such case? You can suppress it for the limited scope - file, method, statement - so that it will be still working outside this selection but will not bother you inside:

  1. Highlight an issue (⌘F1)
    ac InspTutorial simplifiable 2x
  2. Open inspection context menu (⌥⏎)
    ac InspTutorial supress inspection 2x
  3. Select suppressing the inspection for the required scope, for statement for example:
    ac InspTutorial supress result 2x
    You can easily remove the suppression by “Remove suppression” intention action (⌥⏎):
    ac InspTutorial remove suppression 2x
And of course you can disable it for the whole project. If you select Edit inspection... AppCode will show you the preferences for the particular inspection where you can read the description, manage the severity (choose from Typo, Server problem, Weak warning, Info, Warning, Error) or even in some cases configure the inspection’s parameters to reflect your demands more precisely. You can do this for Simplifiable statement for example:
ac InspTutorial inspections prefs 2x

All the inspections in AppCode are split into groups: Objective-C, C++, Swift, General, CSS, XML, JavaScript, etc. Some are based on the compile warnings while others are taking you to the next level. The full list of inspections includes more than 100 possibilities. Go to Preferences | Inspections for it. Also it’s possible to save various configurations as named profiles and use them separately on different projects or scopes inside one project.

Try in action

Let’s us demonstrate how the things work on an example. That will be a missing switch case issue.

  1. AppCode highlights the particular problem as you type (use ⌘F1 to see the description). For example suggests that some enum values are missing in the switch case or the default branch is omitted:
    ac InspTutorial Step 0
  2. Then you can use a quick fix (⌥⏎) like adding a default branch:
    ac InspTutorial Step 1
  3. After accepting:
    ac InspTutorial Step 3
  4. Or select the action from the context menu (⌥⏎):
    ac Insp Tutoprial step 4

Running single inspection

If some particular inspection needs to be called use Run Inspection by name action (⌥⇧⌘I):

ac InspTutorial run inspection by name 2x
Start typing the name and the AppCode helps you with the rest. The full list of the suggested issues for your project is available by calling the Code | Inspect Code.

There you will find several possibilities for the file range you’d like to check:

  • The whole project;
  • The uncommitted files (if any);
  • The recently viewed file;
  • The pre-configured scope.
ac InspTutorial inspection scope 2x

Upon running that AppCode shows the full list of inspections found in the selected scope:

ac InspTutorial inspection scope
And you can navigate through this list, group the issues by directory or severity, apply quick fixes (to one or more errors) and edit settings.

ac InspTutorial hector window
Click the Hector icon ac InspTutorial hector on the Status bar or press ⌥⇧⌘H and you will be able to:

  1. Configure the highlighting level: move slider to one of the three available positions:
    • None: turn off problems highlighting in the editor;
    • Syntax: highlight syntax problems only;
    • Inspections: (default) highlight syntax problems and inspection issues.
  2. Configure the inspections.
  3. Switch on/off the power save mode (the same can be done in File | Power Save Mode menu) - turn it on and save the power especially during the trip when you don’t have power supply. Keep in mind that this mode turns off on-the-fly code inspections.

Last modified: 27 March 2018

See Also