AppCode 2019.2 Help

Manage files and directories

AppCode indexes your project files to enable such features as search, navigation, code completion, code generation, and refactorings. However, your project may contain files for which you don't need these features, for example, logs, binaries, or imported libraries. It is also possible that AppCode may not consider some of your source/header files as project files.

In such cases, you can use the Mark directory as option to specify explicitly how the IDE should treat a certain directory of your project.

Mark directory as menu

Exclude a directory from indexing

If you don't want AppCode to index a certain directory of your project, do the following:

  1. In the Project tool window ⌘1, switch to the Files, Project Source Files, or Project Non-Source Files view.

  2. Right-click the directory you want to exclude, and select Mark Directory as | Excluded.

Code generation, code completion, and refactorings won't be available for this directory. The files won't appear in search results unless you select this directory explicitly in the Find in Path dialog ⇧⌘F. The directory is marked as excluded the Excluded directory icon.

To include the directory back again, right-click it and select Mark Directory as | Cancel Exclusion.

Exclude files

If you don't need specific files, but you don't want to completely remove them, you can temporarily exclude these files from the project. Excluded files are ignored by code completion, navigation and inspections.

To exclude a file, you need to mark it as a plain text file:

  1. Right-click the necessary file in the directory tree of the Project tool window.

  2. Select Mark as Plain Text from the menu.

Plain text files are marked with the plain text icon icon in the directory tree.

To revert the changes, right-click the file and select Mark as <file type> from the menu.

Mark a directory as a library

If AppCode considers an imported library as project files, do the following:

  1. In the Project tool window ⌘1, switch to the Files, Project Source Files, or Project Non-Source Files view.

  2. Right-click the directory with source/header files, and select Mark Directory as | Library Files.

Code generation, code completion and refactorings won't be available for this directory. However, you can make these files available in search results:

  • In Find in Path dialog ⇧⌘F: narrow down your search by selecting the Project and Frameworks scope.

  • When searching everywhere (press twice): check Include non-project items or select Project and Frameworks from the list in the top right corner of the window.

To unmark the directory, right-click it and select Mark Directory as | Unmark.

Mark a directory as project sources and headers

If you have a folder with source/header files, but the IDE doesn't consider them as project files, do the following:

  1. In the Project tool window ⌘1, switch to the Files, Project Source Files, or Project Non-Source Files view.

  2. Right-click the directory with the source/header files, and select Mark Directory as | Project Sources and Headers.

To unmark the directory, right-click it and select Mark Directory as | Unmark.

Change project root

When you open a project, AppCode treats the location of the top .xcodeproj file as a project root directory. When you create a new project, AppCode also places the .xcodeproj file under the root.

However, your project may have a different structure. For example, .xcodeproj can reside in some subdirectory. When opening such a project, you'll receive a notification informing you that some files are located outside of Xcode project. You can find the same message in the Event Log tool window (View | Tool Windows | Event Log):

Change project root notification

In this case, the Files view of the Project tool window wont't be able to display the project structure properly, and such project files as compile.sh and README.md won't be shown.

  • To explicitly point AppCode to the directory that you want to be considered as root, click the Change the project root link in the received notification and select the desired folder in the dialog that opens.

  • If you want to revert this change or choose another root, select File | Change Project Root from the main menu. Alternatively, press ⇧⌘A and find the Change Project Root action.

After changing the project root, the project structure in the Files view of the Project tool window will be reorganized, though the actual files location won't be affected.

Last modified: 10 October 2019