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 Explorer menu, or with keyboard shortcuts.
via Pieces Explorer
If you want to access your saved snippets directly within the VS Code editor, you can:
-
Open the Pieces Explorer from the VS Code sidebar
-
Click on
Saved Materials
in the menu, which will display a list of your saved materials organized by programming language -
Expand any language category to see the full list of snippets
-
Press
return
(macOS) orenter
(Windows/Linux) on your desired snippet to open it and it’s saved metadata in a new tab
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) orctrl+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) orenter
(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.
Adding Filters to your Search
Saved Snippets being viewed in the Pieces Explorer can be filtered down by snippet tags, coding languages, and snippet titles.
To filter through your snippets:
-
Open the Pieces Explorer
-
Click the siphon icon at the top of the explorer to access the filters
-
Enter any tags you want to filter for
-
Filter by coding language
-
Filter by titles on your snippets
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 Explorer 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.
This opens up the snippet in markdown preview mode 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 the within the Pieces Explorer 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 sidebar in your JetBrains IDE by clicking the Pieces icon on the left-hand side of your screen.
Once in the sidebar, you can drag a snippet out of the sidebar and drop it right where you want it in your code.
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 hover over one of the snippets on the dropdown list to view its code before selecting the snippet.
|
|
|
---|---|---|
|
|
|
|
|
|
|
|
|
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 for VS Code Extension 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.