IntelliJ IDEA
 
Get IntelliJ IDEA
You are viewing the documentation for an earlier version of IntelliJ IDEA.

Scratch files

Last modified: 15 June 2021

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 are fully functional, runnable, and debuggable files, which support syntax highlighting, code completion, and all other features for the corresponding file type. 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. You can use scratch files to draft Java code constructs, HTTP requests, JSON documents, and so on.

  • 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.

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