intellij-ideaintellij-14scratch-file

Where are IntelliJ scratch files located?


In IntelliJ IDEA 14, we can create scratch files from Tools > New Scratch File...

Are they stored in some temporary files? If the answer is yes, where are they?

Attempts:

1) I pressed right click > Copy Reference and I pasted it:

1d0b26a2/scratch.2:1

2) I opened .idea\workspace.xml and I have the following part for scratch files:

  <file leaf-file-name="scratch.2" pinned="false" current-in-tab="true">
    <entry file="scratchpad://1d0b26a2/scratch.2">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="636">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="20" />
          <folding />
        </state>
      </provider>
    </entry>
  </file>

For a normal file the entry path starts with file:// instead of scratchpad://.


Solution

  • I upgraded my IntelliJ IDEA to 14.1 and I found the scratch files.

    If you create a scratch file, its path can be found in many different ways:

    1. On the title bar

    2. Right click on the tab > Copy Reference

      enter image description here

      You can paste it anywhere and it will look like:

      C:/Users/username/.IntelliJIdea14/config/scratches/scratch

    3. Right click on the tab > Rename File...

    4. Right click on the tab > Local History > Show History

    5. In .idea\workspace.xml it looks like:

      <file leaf-file-name="scratch" pinned="false" current-in-tab="false">
        <entry file="file://$APPLICATION_CONFIG_DIR$/scratches/scratch">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="0.0">
              <caret line="4" column="17" selection-start-line="4" selection-start-column="17" selection-end-line="4" selection-end-column="17" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>