Exploring Materials
The Explore
feature in the Pieces for VS Code Extension helps you understand selected code, just as if it was a code snippet in your repository, without needing to save it.
When this feature is activated, the Pieces Copilot within the Pieces for VS Code Extension studies the snippet and generates useful metadata—like tags, related links and authors, and more—so you can view it in markdown.
Snippet Insights with Pieces
To dive deeper into a code snippet using Pieces Insights, you can use the tool menu or keyboard shortcuts.
When this feature is activated, the Pieces Copilot analyzes the snippet and generates useful metadata called Pieces Insights—like tags, related links and authors, and more—so you can view it in markdown.
via Right-Click Menu
To explore a code snippet using Pieces Insights with the right-click menu:
-
Highlight the code you want to analyze in your editor.
-
Right-click and select
Explore
from the context menu.
When you do this, a success message will appear in the lower right corner of your editor, with clickable View Insights
text.
Clicking this will open a new window in the right toolbar and display the Pieces AI generated Pieces Insights.
Clicking View Insights
opens a new panel in the right toolbar, where you can view the AI-generated Pieces Insights.
via Keyboard Shortcut
If you want to use a keyboard shortcut to view Snippet Insights, you can do so—toggle the Explore
action by pressing ⌥+shift+e
(macOS) or shift+alt+e
(Windows/Linux).
Suggested Materials
In the Pieces Explorer, you can find the Suggested Materials
section.
The snippets displayed here are relevant to your current file so that you can add them to your project with less searching—the goal here is to present the exact snippet needed, when you need it, with suggestions becoming more refined the more Suggested Materials are used, and the more snippets are saved.
Saving Pieces Insights as Snippets
From the Pieces Explorer sidebar, you have the option to right-click and save some automatically-located insights as a snippet direct to your local repository.
-
With an open code window, open Pieces Explorer
-
Open the section labeled
Explored Materials
at the bottom of the Pieces Explorer -
Right-click an Explored Material and click
Pieces: Save Explored Material
This will save the explored material as a snippet in the cloud, allowing you to access it anytime, anywhere.
View Explored Materials
You can view materials you’ve previously explored—such as highlighted code selections where you used the Explore
feature to find Snippet Insights—in the side view of the Pieces Explorer.
You can also view and clear your explored materials via the command palette.
To focus on your Explored Materials:
-
Open the command palette with
⌘+shift+p
(macOS) orctrl+shift+p
(Windows/Linux) -
Search for
Pieces Explorer: Focus on Explored Materials View
-
Press
return
(macOS) orenter
(Windows/Linux)
Here, you can view your explored materials, save them to Pieces, or delete them— just right-click on a saved material and select the action that most benefits you.
Clearing your Explored Materials is an excellent way to keep your materials up-to-date and your project focused.
To clear your Explored Materials:
-
Open the command palette with
⌘+shift+p
(macOS) orctrl+shift+p
(Windows/Linux) -
Search for
Pieces Explorer: Focus on Explored Materials View
-
Press
return
(macOS) orenter
(Windows/Linux) -
A prompt will appear in the bottom right asking if you’re sure you want to delete all explored materials
-
Select
Delete All
Automatic Saving Explored Materials
Once you’ve explored a material, you have the option to enable a setting which automatically saves these code snippets (and their saved metadata) to your repository.
To do this:
-
Navigate to
Settings
-
Search for
Pieces
-
Look for and enable or disable
Pieces > Explored Snippet Insights: Explore and Save
To utilize the Explore Materials feature, you must be connected to your Pieces Cloud account.
Refresh your Saved Snippets
Sometimes, when saving new snippets from other plugins and extensions, you need to refresh the Pieces for VS Code Extension to see the updated snippet list.
To refresh the list, click the refresh button at the top of the Pieces Explorer.