Saving

The Pieces for JetBrains Plugin lets developers to save code snippets directly within their JetBrains IDEs—this ensures that our snippets are securely stored and easily accessible for future use.


Saving Snippets

There are several ways to save code with the Pieces for JetBrains plugin—through the right-click menu, hotkeys, or dragging and dropping code into the Pieces sidebar.

There’s also the fine-tuned saving feature called Save to Pieces As which lets you edit and adjust the automatically-generated metadata to your liking.

via Right-Click Menu

You can save snippets by accessing the tool menu.

To save a snippet using this method:

  1. Highlight the code you want to save

  2. Right-click on the highlighted code

  3. Click Save to Pieces

This will trigger a success message in the bottom-right corner of your screen to let you know that the save was successful.

via Keyboard Shortcut

Keyboard shortcuts are another easy way to save useful developer materials.

To save a snippet via keyboard shortcuts:

  1. Highlight the code you want to save

  2. Use the command ⌥+⌘+p (macOS) or ctrl+alt+p (Windows/Linux) to save the code as a snippet

Saving a snippet via keyboard shortcut will trigger the same success modal in the bottom right-hand corner of your screen to let you know the save was successful.

via ‘Save to Pieces As’

The Save to Pieces As command gives you fine control over the name of the snippet, as opposed to using AI to automatically generate a snippet based on the snippet’s contents, as well as the ability to change what metadata gets saved alongside it.

To do this:

  1. Highlight the code you want to save

  2. Right-click to open the tool menu

  3. Hover over Pieces … and select Save to Pieces As

This action will trigger the Save to Pieces As window, where you can edit the name, language, associated authors and related links, and more.

via Drag & Drop

One of the many intuitive features of the Pieces for JetBrains Plugin is that it allows you simply drag and drop highlighted code into the Pieces sidebar to save it as a snippet.

Keep in mind, though, that you won’t have the same fine-grain control as you would using the Save to Pieces As method.

via Copilot Chat

When you start a conversation about a piece of code in your active file—or have any code block present in your Copilot Chat—you can save it to Pieces using the Save to Pieces button in the Copilot Chat view.

What’s Stored When You Save a Snippet

When you save a snippet to your Pieces Cloud, it’s more than just the code that gets stored.

The Pieces Copilot captures:

  • Type: Categorizes the snippet (e.g., API call, function, class) with it’s code language.

  • Associated Tags: Keywords associated with the snippet for easier searching.

  • Custom Description: Specifies precisely which lines (in numerical form) the snippet is from, as well as the file from which it originated—very useful for mind-mapping.

  • Smart Description: AI-generated descriptions that summarize the snippet’s purpose and function.

  • Suggested Searches: Related searches that help you discover similar snippets.

  • Related Links: References to documentation, code repositories, or other relevant resources.

  • Related People: Associated collaborators or contributors.

Where Saved Snippets Live

Saved snippets are stored locally on your device, ensuring accessibility even when offline.

There are two ways to view your saved snippets—by viewing them in your JetBrains IDE’s sidebar menu, or with the Search Everywhere feature.

Updated on