Exploring Materials

The Explore with Pieces Insights helps you understand selected code, just as if it was a code snippet in your repository, without actually needing to save it to your repository.

When this feature is activated, the Pieces Copilot within the Pieces for JetBrains Plugin 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 desired code in your editor

  2. Right-click the selection

  3. Choose Explore with Pieces Insights 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.

Pieces Insights contains your snippet, its description, and associated metadata.

Saving Pieces Insights as Snippets

From the Pieces Insights sidebar, you have the option to right-click and save some automatically-located insights as a snippet direct to your local repository.

Suggested Materials

On the right side of the JetBrains IDE, you’ll see the option Pieces. After clicking this option, you’ll have a new menu pop-open with all of your saved snippets and a section called Suggested Snippets.

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 Snippets are used, and the more snippets are saved.

View Explored Materials

To access previously explored materials, click on the Pieces Saved Materials icon located on the right-side toolbar.

This will populate the toolbar menu with a scrollable collection of your saved snippets, organized automatically by coding language. The snippets present will match the coding language of your currently active file.

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 Pieces Insights tab on the right side of your IDE

  2. At the top of the section, select the trashcan icon

  3. This will open a prompt asking if you’d like to clear all explored materials

  4. Select Yes

Automatic Saving of Explored Materials

Once you’ve explored a material, you have the option to enable a setting which automatically saves them to your repository for future use.

To do this:

  1. Navigate to Settings, then Tools, then Pieces

  2. Enable the option titled Automatically Save Explored Materials

To utilize the Explore Materials feature, you must be connected to your Pieces Cloud account.

Refresh your Saved Snippets

You can view your most recently saved snippets from the right-click context menu in JetBrains.

Sometimes, when saving new snippets from other Pieces plugins and extensions, you'll have to refresh your list to get a fully updated snippet list.

To refresh that list after saving a new snippet, right-click in your code and select Refresh Saved Pieces—alternatively, you can click the refresh button at the top of the sidebar view.

Updated on