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 Insightslike 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:

  1. Highlight the code you want to analyze in your editor.

  2. 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.

  1. With an open code window, open Pieces Explorer

  2. Open the section labeled Explored Materials at the bottom of the Pieces Explorer

  3. 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:

  1. Open the command palette with ⌘+shift+p (macOS) or ctrl+shift+p (Windows/Linux)

  2. Search for Pieces Explorer: Focus on Explored Materials View

  3. Press return (macOS) or enter (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:

  1. Open the command palette with ⌘+shift+p (macOS) or ctrl+shift+p (Windows/Linux)

  2. Search for Pieces Explorer: Focus on Explored Materials View

  3. Press return (macOS) or enter (Windows/Linux)

  4. A prompt will appear in the bottom right asking if you’re sure you want to delete all explored materials

  5. 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:

  1. Navigate to Settings

  2. Search for Pieces

  3. 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.

Updated on