Scratches
On this page:
- Basics
- Creating scratch files
- Creating scratch buffers
- Observing the available scratches
- Deleting scratches
- Changing the language of a scratch
- Important notes about scratches
Basics
JetBrains Rider provides a temporary editor. You can create a text or a piece of code for search or exploration purposes. JetBrains Rider 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 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
- Do one of the following:
- Press Ctrl+Shift+Alt+Insert.
- Press Ctrl+Shift+A, start typing
scratch file..
, and choose the corresponding action.
- Select the language of the future scratch from the list that JetBrains Rider suggests. JetBrains Rider creates a temporary editor tab with the name
scratch.<extension>
. In the future, the default names will bescratch_<number>.<extension>
. - Type the desired code.
Creating scratch buffers
To create a scratch buffer, follow these steps:
- Press Ctrl+Shift+A or search everywhere.
- Start typing the command name
New Scratch Buffer
:JetBrains Rider creates a temporary editor tab with the name
buffer1
. In the future, the default names will bebuffer<number>
. - 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:
- Choose Scratches view in the Solution window.
- Press Alt+F1 and choose Scratches (Navigating Between IDE Components).
Deleting scratches
To delete a scratch file or buffer, follow these steps:
- Switch to the Scratches view of the Solution window.
- Under the
Scratches
pseudo-folder, right-click the scratch to be deleted, and choose Delete on the context menu. - 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:
- Switch to the Scratches view of the Solution window, and open for editing the scratch file or buffer you want to change language for.
- Right-click the editor background, and choose on the context menu.
- 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.
- action keeps extension in sync, if it exists.
Important notes about scratches
Note the following:
- Local history for scratches is supported.
- It is possible to perform clipboard operations with scratches.
- The scratches are stored, depending on your operating system,
- Under JetBrains Rider home, in the directory
config/scratches
(on Windows/*NIX) ~ Library->Preferences-><JetBrains Rider>XX->scratches
(on macOS)
- Under JetBrains Rider home, in the directory