Locate Materials in Pieces Drive

To locate your snippets, open a file in VS Code and use one of two methods—searching with the Pieces Drive menu, or with keyboard shortcuts.

How to Search for Saved Materials

You can search for snippets of code and other materials saved to your Pieces Drive right from within the editor. You can also apply search filters to help narrow down results.

via Pieces Drive

If you want to access your saved snippets directly within the VS Code editor, you can:

Open the `Pieces Drive` from the VS Code sidebar Once the `Pieces Drive` is open, you have access to a wide range of options that allow you sort through your snippets
<Image src="https://storage.googleapis.com/hashnode_product_documentation_assets/vs_code_extension_assets/using_snippets/search_and_reuse/opening_a_snippet.gif" alt="" align="center" fullwidth="true" />

via Search Feature

You can also use Pieces: Search Pieces to find specific snippets—this is where you’ll enter a specific query, which is useful when you know exactly what you want:

Open the **Command Palette** using `⌘+shift+p` (macOS) or `ctrl+shift+p` (Windows/Linux) Type `Pieces: Search Pieces` Enter your search query, **scrolling or using the arrow keys** to navigate the list Press `return` (macOS) or `enter` (Windows/Linux) on your desired snippet to open it and it’s saved metadata in a new tab
<Image src="https://storage.googleapis.com/hashnode_product_documentation_assets/vs_code_extension_assets/using_snippets/search_and_reuse/search_snippets.gif" alt="" align="center" fullwidth="true" />
You can search with tags, descriptions, names, types, or even languages themselves to narrow down your search.

Adding Filters to your Search

Saved Snippets being viewed in the Pieces Drive can be filtered down by snippet tags, coding languages, and snippet titles.

To filter through your snippets:

Open `Pieces Drive` via the VS Code sidebar Select the search bar at the top of the Pieces Drive After clicking on the search bar, you’ll have the option to quick filter by `Titles`, `Annotations`, or `Content` Using the filter, enter a search query in the search bar
<Image src="https://storage.googleapis.com/hashnode_product_documentation_assets/vs_code_extension_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.

For any tags you don’t want to set, you can leave them blank by just pressing `return` (macOS) or `enter` (Windows/Linux).

Viewing and Reusing Saved Snippets

Saved snippets can be viewed alongside their saved metadata by opening up them up directly from the Pieces Drive or by clicking on them once they’ve been found using the Pieces: Search Pieces function from the dropdown list. You can also right click on the editor and select Search Pieces in the right-click options.

After opening a snippet, the snippet in markdown preview mode opens up in a separate window.

From this view, you can then highlight the code and right-click to copy the code to your clipboard, or use the ⌘+c (macOS) or ctrl+c (Windows/Linux) shortcut.

via Right-Click Menu

The Pieces for VS Code Extension provides a host of actions that appear once you right-click a snippet from within the Pieces Drive menu.

There are a number of available material management and Pieces Copilot-related actions available on this menu, which you can read more about here—or view an expanded table of them below.

via Pieces Sidebar

You can view snippets by opening up the Pieces Drive sidebar in your VS Code by 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: Search Pieces function, you can click on one of the snippets on the dropdown list to view it’s 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

Every product within the Pieces Suite utilizes PiecesOS to gather information regarding the context of your snippets.

When you modify a snippet in the Pieces Desktop App—like changing its name or description, tags, or any other metadata—those updates are automatically shown in your Pieces Drive without the need for refreshing.

If your snippets aren’t updating immediately, refer to the [troubleshooting guide](/products/extensions-plugins/visual-studio-code/troubleshooting) for instructions on how to refresh your snippet list.