Saving
The Pieces for Obsidian Plugin provides several ways to save snippets, ensuring your most useful content is always at hand within your notes.
Saving Snippets
There are two ways to save code snippets with the Pieces for Obsidian plugin, through the right-click menu, or by saving 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:
Highlight the Section
Select the section you want to save.
Right-Click on the Highlighted Section
Open the context menu by right-clicking on the selected section.
Choose Save to Pieces
From the menu, select Save to Pieces.
via Embedded Buttons
To save code snippets directly from your notes:
Locate the Code Block
Find the code block you want to save within your note.
Click the Save Button
Use the Save button embedded within the code block to save it to Pieces.
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 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.
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 Snippets Live
Saved snippets are stored locally on your device, ensuring accessibility even when offline. This also means that any Pieces for Developers extension or plugin—or even the Pieces Desktop App—has constant, up-to-date access to your saved materials.
There are two ways to find your saved snippets—via the Pieces Explorer
menu, or with the Pieces: Search Pieces
feature.