Saving Materials

You can save code snippets as materials to the Pieces Drive using the right-click menu or embedded buttons in code sections.

You can use this feature to save all kinds of useful markdown and code materials, such as:

  • API endpoint definitions

  • Utility functions or commonly used helper methods

  • Predefined templates for organizing notes

  • Task Lists

  • Code Blocks

  • Reusable patterns for internal or external links

via Right-Click Menu

To capture useful code snippets via the right-click menu:

Select the section you want to save. Open the context menu by right-clicking on the selected section. From the menu, select `Save Selection to Pieces`.
<Image src="https://storage.googleapis.com/hashnode_product_documentation_assets/web_extension/_MAIN/right_click_hover_save.png" alt="" align="center" fullwidth="true" />

via Embedded Buttons

To save code snippets directly from a code block in your browser:

Find the code block you want to save within your browser. Use the `Copy and Save` button embedded below the code block to save it to Pieces Drive and copy the snippet to your keyboard.
<Image src="https://storage.googleapis.com/hashnode_product_documentation_assets/web_extension/pieces_drive/saving_materials/hover_copy_save.png" alt="" align="center" fullwidth="true" />

via Keyboard shortcut

You can quickly save a selection to Pieces Drive.

Just highlight the section you want to save and press ⌥+shift+s (macOS) or alt+shift+s (Windows/Linux). Pieces will then save the selection to your Pieces Drive.

via Copilot Chat

You can take any code block existing in your Copilot Chat and click Save to Pieces—like code generated by Pieces Copilot, code blocks you added as context that weren’t saved as individual snippets, and any other kind of code.

To do so, click the Save to Pieces button on any code block within the Copilot Chat view.

What’s Stored When You Save a Material

When you save a snippet to your Pieces Drive, more than just the code is stored.

The Pieces Copilot captures:

  • Type: Categorizes the snippet (e.g., API call, function, class) and its programming language.

  • Associated Tags: Keywords linked to the snippet for easier searching.

  • Custom Description: Specifies exactly which lines (in numerical form) the snippet is from and the file it came from—very useful for mind-mapping.

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

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

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

  • Related People: Associated collaborators or contributors.

Additionally, the Pieces Copilot scans saved snippets for sensitive information, such as API keys, passwords, or authentication tokens, to ensure no confidential data is accidentally stored.

Where Saved Materials Live

Saved snippets are stored locally on your device, ensuring offline accessibility. This also means that any Pieces extension, plugin, or even the Pieces Desktop App, has constant, up-to-date access to your saved materials.

Read more about how to find your saved snippets here.