AppCode 2019.2 Help

Scratch files

Sometimes you may need to create temporary notes or draft up some code outside of the project context. Instead of switching to a different application for this purpose, you can use scratch files and scratch buffers.

  • Scratch files support syntax highlighting for the corresponding file type, and you can use them to draft any code instances, from Objective-C/Swift constructs to JSON documents. For example, while working on one project, you may come up with an idea for a method that you could later use in another project. You can create a scratch file with a draft of the method, which is not stored in your project directory but can be accessed and opened from another project.

  • Scratch buffers are simple text files without any coding assistance features. Scratch buffers can be used for simple task lists and notes to yourself. They are also not stored in the project directory but can be accessed and opened from another project. You can create up to five scratch buffers with default names, which are rotated and reused by clearing the content.

Create a scratch file

  1. From the File menu, select New Scratch File (or press ⇧⌘N).

  2. Select the language of the scratch file. Scratch files of the same type are automatically numbered and added to the Scratches and Consoles directory of the Project tool window (in the Files view).

Create a scratch buffer

There is no dedicated menu item for the action to create a new scratch buffer, but you can use the Find Action popup ⇧⌘A and run the New Scratch Buffer action.

Also, you can create a shortcut for the New Scratch Buffer action as described in Configure keyboard shortcuts.

AppCode creates a text file named buffer1.txt. The next scratch buffer you create is named buffer2.txt, and so on up to buffer5.txt. When that limit is reached, it will recreate buffer1.txt and suggest to clear the content for it. If you want to make sure that a scratch buffer is not cleared after you have five, you can rename it.

View the list of scratch files and buffers

To see the list of created scratch files and buffers, open the Project tool window, expand Scratches and Consoles, and then expand Scratches. Scratches and Consoles directory is available when you select the Files view.

By default, scratch files and buffers are sorted alphabetically by their names and next by their extensions (types), which automatically means that buffer files always come first. To sort scratch files by types, click the Show Options Menu button or right-click the Files tab and select Sort by Type.

Scratches and Consoles

Scratch files and buffers are stored in the IDE configuration directory under scratches. They are available from any IDE and project that uses this configuration directory.

View documentation for scratches

  • Select any scratch file or buffer and press F1 to view quick documentation with the location, type, size, creation and modification date of the file.

Move scratches

  1. In the Project tool window , select the Files view and in the Scratches and Consoles | Scratches directory, select the scratch file to move.

  2. Press F6 and select the target folder in the dialog that opens.

Change the language of a scratch file or buffer

  1. In the Project tool window , open the Files view, expand Scratches and Consoles, and then expand Scratches.

  2. Right-click a scratch file or buffer and then click Change Language. The current language is specified in parentheses.

  3. Select the desired language. You can start typing the name of the language to narrow down the list.

Like any other file, you can perform the following operations with scratch files and buffers:

Last modified: 10 October 2019