Searching

The Pieces for VS Code Extension makes finding saved snippets quick and seamless, helping you stay productive without breaking your workflow.


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 keyboard shortcuts.

via Pieces Drive

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

1

Locate Pieces Drive

Open the Pieces Drive from the VS Code sidebar

2

Filter, Search, and Explore

Once the Pieces Drive is open, you have access to a wide range of options that allow you sort through your snippets

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:

1

Open the Command Palette

Open the Command Palette using ⌘+shift+p (macOS) or ctrl+shift+p (Windows/Linux)

2

Enter the Command

Type Pieces: Search Pieces

3

Enter your Search Query

Enter your search query, scrolling or using the arrow keys to navigate the list

4

Choose your Desired Snippet

Press return (macOS) or enter (Windows/Linux) on your desired snippet to open it and it’s saved metadata in a new tab

You can search with tags, descriptions, names, types, or even languages themselves to narrow down 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:

1

Open Pieces Drive

Open Pieces Drive via the VS Code sidebar

2

Select the Search Bar

Select the search bar at the top of the Pieces Drive

3

Choose the Filter Option

After clicking on the search bar, you’ll have the option to quick filter by Titles, Annotations, or Content

4

Enter your Query

Using the filter, enter a search query in the search bar

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 for Developers 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 for instructions on how to refresh your snippet list.

Updated on