Finding Saved Snippets
To locate your snippets, open a file in VS Code and use one of two methods: searching with the Pieces Drive menu or with Search Everywhere.
via Pieces Drive
If you want to access your saved snippets directly within the JetBrains IDE, you can:
<Image src="https://storage.googleapis.com/hashnode_product_documentation_assets/jetbrains_plugin_assets/jetbrains_plugin_assets/using_snippets/search_and_reuse/searching_snippets_drive.gif" alt="" align="center" fullwidth="true" />
via Search Everywhere
Whether you’re on macOS, Windows or Linux, you must double-press the Shift key twice to open up the Search Everywhere menu.
Once the menu is open, switch to the Pieces tab, then enter a search query to search your entire Pieces repository for any snippet you’ve saved.
After you’ve located a snippet, you can press Enter to open it in a new window and view the snippet’s code and saved context.
You can also press shift+shift again and search while remaining in the Search Everywhere menu’s All tab, but the Pieces tab is the de facto home for seeing only saved snippet search results.
Adding Filters to your Search
You can filter saved snippets in the Pieces Drive using snippet tags, coding languages, and titles.
To filter through your snippets:
<Image src="https://storage.googleapis.com/hashnode_product_documentation_assets/jetbrains_plugin_assets/jetbrains_plugin_assets/using_snippets/search_and_reuse/filtering_snippets.gif" alt="" align="center" fullwidth="true" />
When you’ve finished entering your filters, the Pieces Explorer will only display the snippets that match your filters. You can clear this by clicking the siphon icon with an x over it.
Viewing and Reusing Saved Snippets
Saved snippets can be viewed alongside their saved metadata by opening up them up directly from the Pieces Drive—either by pressing enter on a highlighted snippet, or by double-clicking it.
This opens up the snippet in markdown preview mode in a separate window.
From the opened markdown preview, you can then select Copy to Clipboard in the top-left corner of the snippet’s embedded code box or use the ⌘+c (macOS) or ctrl+c (Windows/Linux) shortcut after selecting the section.
via Right-Click Menu
The Pieces for JetBrains Plugin offers several actions when you right-click a snippet in the Pieces Drive menu.
This menu offers several material management and Pieces Copilot-related actions. Read more about them here or see the expanded table below.
via Pieces Sidebar
You can view snippets by opening up the Pieces sidebar in your JetBrains IDE and clicking the Pieces Drive Icon on the left-hand side of your screen.
Once in the sidebar, you can insert a snippet and place it exactly where you want it in your code by clicking Insert at Cursor.
You can also right-click a snippet and select Copy to copy it to the clipboard, allowing you to paste it anywhere you need.
Previewing Saved Snippets
While using the Pieces Drive sidebar, you can click on one of the snippets in the snippets list to view its code before selecting the snippet.
Add to Copilot Context |
Ask Copilot |
Copy |
|---|---|---|
Insert at Cursor |
Shareable Links |
Annotations |
Links |
Tags |
Reclassify |
Edit |
Rename |
Delete |
Real Time Snippet Streaming
Each product in the Pieces Suite uses PiecesOS to get information about your snippets' context.
When you update a snippet in the Pieces Desktop App—such as a name or description, tags or any of the other metadata—those changes are also reflected in your Pieces Drive without refreshing.