Searching

You can find your saved code snippets easily with the Pieces for JetBrains Plugin by utilizing a few different search methods.


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:

1

Locate Pieces Drive

Open the Pieces Drive from the JetBrains 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 Everywhere

Whether you’re on macOS, Windows or Linux, all you need to do is 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.

The default behavior for the Search Everywhere feature can be changed to whatever keymapping you prefer—learn more about this here.

You can filter saved snippets in the Pieces Drive by snippet tags, coding languages, and snippet titles.

To filter through your snippets:

1

Open Pieces Drive

Open Pieces Drive via the JetBrains 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—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.

There are several material management and Pieces Copilot-related actions available in this menu. 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 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 Drive sidebar, you can click on one of the snippets in the snippets 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

Each product in the Pieces Suite uses PiecesOS to get information about your snippets' context.

When you update a snippet in the Pieces for Developers 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.

If your snippets are not updating right away, see the troubleshooting guide to details on how to refresh your snippet list.

Updated on