Scratch файлы в IDE JetBrains
Scratch-файлы — это временные файлы для экспериментов или прототипирования в редакторе без создания файлов внутри проекта.
Ctrl + Alt + Shift + Insert — открыть панель выбора шаблона/языка для создания скретч-файла.
Scratch-файл храниться до его закрытия.
Создается и открывается редакторе временный файл в каталоге:
ls -la ~/.config/JetBrains/PhpStorm2022.1/scratches/
Вы можете открыть scratch-каталог во встроенном терминале: Ctrl + Shift + A » Open in Terminal.
И запустить выполнение файла. Или запустить встроенный в PHP веб-сервер:
php -S --port 8001
#ide #phpstorm #scratch files
Scratch files
Sometimes you may need to create temporary notes or draft up some code outside the project context. Instead of switching to a different application, you can use scratch files and scratch buffers .
Scratch files and buffers are not related to a specific project. They are available for any project that you open with the specific IDE instance.
- Scratch files are fully functional, runnable, and debuggable files that 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 opened when you’re working on any other project. You can use scratch files to draft 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 and can be opened from any other 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
- Go to File | New | Scratch File or press Control+Alt+Shift+Insert . Alternatively, in the Project tool window , right-click any area and navigate to New | Scratch File .
- 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 view.
Alternatively, you can create a new scratch file with the contents of the current selection in the editor. Select some text or code, press Alt+Enter and then select Create new scratch file from selection . PyCharm will attempt to detect the language of the selected fragment and use the appropriate type and extension. If it can’t detect the language of the selection, PyCharm will create the file with the same type and extension as the original file.
PyCharm numbers scratch files sequentially starting from 1. If you close a tab with an empty scratch file, PyCharm deletes it.
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 Control+Shift+A and run the New Scratch Buffer action.
You can also add a shortcut for the New Scratch Buffer action as described in Configure keyboard shortcuts.
PyCharm 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 PyCharm reaches that limit, it will recreate buffer1.txt and suggest clearing the content for it. If you want to make sure PyCharm does not clear the scratch buffer after you have five, you can rename it.
View all scratch files and buffers
- Open the Project view and expand Scratches and Consoles | Scratches .
Consoles are used to compose and execute SQL statements for databases defined in PyCharm as data sources. This functionality is available only when the Database Tools and SQL plugin is enabled. For more information, refer to Query consoles. - Use the Find Action popup Control+Shift+A to invoke the Show Scratch Files action and view all available scratch files in a popup:

Location of scratch files and buffers
By default, PyCharm stores scratch files and buffers in the IDE configuration directory under scratches . They are available from any IDE and project that uses this configuration directory.
Установка на Windows
Сначала смотрим, какая архитектура у нашей операционной системы.
Нажимаем правой кнопкой мыши на кнопку Пуск, в появившемся диалоговом окне выбираем пункт Система, и в разделе О системе смотрим пункт Тип системы.

Установка Python на Windows
Если в пункте Тип системы написано 64-разрядная операционная система, процессор x64, заходим на официальный сайт Python в раздел Downloads, выбираем последний релиз (на данный момент — Python 3.8.2), переходим в раздел Files и скачиваем Windows x86-64 executable installer .
Если в пункте Тип системы написано 32-разрядная операционная система, скачиваем Windows x86 executable installer.

Скачав нужную версию дистрибутива, запускаем установку. Отмечаем флажок Add Python 3.8 to PATH. Это позволит вызывать интерпретатор python и пакетный менеджер pip в командной строке, не вводя полный путь к исполняемым файлам.
Выбираем пункт Customize installation.

Нажимаем Next.

Выставляем флажок Install for all users.
Место установки Python при этом должно автоматически поменяться на C:\Program Files\Python38 .
Нажимаем Install.

Следим за процессом установки.

Закрываем окно установщика.

Теперь мы должны убедиться, что установка прошла успешно.
Нажимаем Пуск, находим пункт Служебные и запускаем командную строку. Или вводим команду cmd в поле Введите здесь текст для поиска и нажимаем Enter .

В командной строке вводим python —version и нажимаем Enter . В окне командной строки должна появиться информация об установленной версии интерпретатора Python 3.

Установка успешно завершена.
Установка PyCharm CE на Windows
Заходим на сайт JetBrains и скачиваем PyCharm Community Edition для Windows.

Запускаем установку. Нажимаем Next.

Ещё раз нажимаем Next.

Добавляем исполняемый файл PyCharm Community Edition в переменную PATH и ассоциируем файлы с исходным кодом Python с PyCharm Community Edition. Нажимаем Next.

Нажимаем Install.

Следим за процессом установки.

Выбираем Reboot now для немедленной перезагрузки компьютера или выбираем I want to reboot later, чтобы перезагрузить компьютер позже. Помним, что перед первым запуском PyCharm Community Edition мы должны перезагрузить компьютер.

Установка успешно завершена.
Установка Far Manager на Windows
Для комфортной работы в Windows нам может понадобиться консольный двухпанельный файловый менеджер — Far Manager.
Заходим на сайт Far Manager и скачиваем установщик msi, соответствующий архитектуре Windows.

Запускаем установщик и нажимаем Next.

Нажимаем Next.

Оставляем всё как есть и нажимаем Next.

Нажимаем Install.

Нажимаем Finish.

Установка успешно завершена.
Дополнительные ссылки
- Интегрированная среда разработки
- PyCharm
- FAR Manager
- Переменная PATH
- Интерфейс командной строки
- Cmd.exe
What is a Scratch File?

I am currently trying to figure out all the functions that my IDE has, and I have come across a predefined folder when I create a project that is called ‘scratches and consoles’. The IDE only allows me to create Scratch Files but I don´t know what that kind of file is and what Is its purpose. Could someone give me a hand with this?
asked Sep 21, 2020 at 15:43
Luis Orbaiceta Luis Orbaiceta
453 4 4 silver badges 15 15 bronze badges
1 Answer 1
It’s something like temporary notes with ability to highlight/format your code.
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.
You can read more about it at JetBrains — Scratch files.
