PyCharm Edu 2017.3 Help

Scratches

Basics

PyCharm Edu provides a temporary editor. You can create a text or a piece of code for search or exploration purposes. PyCharm Edu suggests two types of temporary files:

Scratch files
The scratch files are fully functional, runnable, debuggable, etc. They require a language to be specified and have an extension. The scratch files are created via Ctrl+Shift+Alt+Insert.
Scratch buffers
The scratch buffers are only intended for pure editing, and as such they do not require specifying a language and do not have an extension. The scratch buffers belong to .txt type by default.

This action has no dedicated shortcut, but you can configure one as described in the section Configuring Keyboard ShortcutsConfiguring Keyboard Shortcuts-->.

Buffer files are reused after creating 5 files. So doing, after reuse, the content and language are reset.

Creating scratch files

To create a scratch file

  1. Do one of the following:
    • On the main menu, choose File | New Scratch File.
    • PressCtrl+Shift+Alt+Insert.
    • Right-click anywhere in the Project Tool Window and choose New | New Scratch File from the context menu.
    • PressCtrl+Shift+A, start typing scratch file.., and choose the corresponding action.
  2. Select the language of the future scratch from the list that PyCharm Edu suggests. PyCharm Edu creates a temporary editor tab with the name scratch.<extension>. In the future, the default names will be scratch_<number>.<extension>.
  3. Type the desired code.

Creating scratch buffers

To create a scratch buffer, follow these steps:

  1. Press Ctrl+Shift+A or search everywhere.
  2. Start typing the command name New Scratch Buffer:
    new scratch buffer

    PyCharm Edu creates a temporary editor tab with the name buffer1. In the future, the default names will be buffer<number>.

  3. Type the desired code.

Note that though this action has no keyboard shortcut, you can still configure one as described in the section Configuring Keyboard Shortcuts. You can also switch from scratch files to scratch buffers by reassigning the shortcut to avoid garbage buildup.

Observing the available scratches

To observe the available scratch files and buffers, do one of the following:

Closing scratches

To close a scratch file or buffer, just click close1 on the editor tab. Refer to the section Closing Files in the Editor for details.

Deleting scratches

To delete a scratch file or buffer, follow these steps:

  1. Switch to the Scratches view of theProject Tool Window.
  2. Under the Scratches pseudo-folder, right-click the scratch to be deleted, and choose Delete on the context menu.
  3. Confirm deletion.

Changing the language of a scratch

If you want to change the scratch's language when a scratch is already created, you can do so with the aid of the editor's context menu. This is how it's done:

  1. Switch to the Scratches view of theProject Tool Window, and open for editing the scratch file or buffer you want to change language for.
  2. Right-click the editor background, and choose Change Language (<current language>) on the context menu.
  3. Select the desired language.

    Note the following:

    • Four latest items appear on top of the list before a separator.
    • You can narrow down the list by typing the language name.
    • You can assign a shortcut to this action as described in the section Configuring keyboard shortcuts.
    • Change Language action keeps extension in sync, if it exists.

Renaming, copying and moving scratches

PyCharm Edu makes it possible to perform rename refactoring of the scratches. To rename a scratch, follow these steps:

  1. In theProject Tool Window, switch to the Scratches view and select the scratch to be renamed.
  2. PressShift+F6.

You can also perform renaming in the other ways:

  • In NavBar: Jump to NavBar ( Alt+Home ) -> Rename ( Shift+F6 ).
  • In the Project tool window | Scratches view: Select In | Project | Scratches ( Alt+F1 )-> Rename (Shift+F6).
  • Right from the editor: Refactor | Rename File.

Copy and Move file actions are available the same way.

Note that when copying a scratch, PyCharm Edu includes the respective extension that corresponds to the file type. This is how it's done:

  1. In theProject Tool Window, switch to the Scratches view and select the scratch to be copied.
  2. PressF5. PyCharm Edu shows the following dialog box:
    copy scratch

    This dialog box shows the scratch name with the corresponding extension. Note that when you copy a scratch buffer, the extension is .txt:

    copy scratch buffer
Last modified: 14 December 2017