Editing
Maintaining an up-to-date library of code snippets in the Pieces for VS Code Extension is made easy through seamless editing.
How to Edit Snippets
To modify an existing snippet, follow these steps:
-
Open the Pieces Explorer via the VS Code sidebar
-
Navigate to the
Saved Materials
section and locate the snippet you want to adjust -
Right-click on the snippet and select
Edit
from the context menu -
Make your changes, then save using
⌘+s
(macOS) orctrl+s
(Windows/Linux)
After saving, the editor will automatically return to the main snippet view, with your changes applied instantly.
Actions from the Editing View
When you right-click on a saved snippet in the Pieces Explorer, you are presented with a tool menu filled with Pieces functionalities—some of which are related to the Pieces Copilot, and others which are designated material management actions.
Pieces Copilot Actions
From this view, you can select a number of Copilot-centric actions—view them in the table below.
| Adds the snippet to the context of your existing Copilot Chat conversation. |
---|---|
| Triggers the input modal and lets you type a prompt directly into the field without changing your active file view. |
| Inserts the code snippet at the point of your cursor inside your active file. |
| Shows shareable links that have been generated for that snippet, if applicable. |
Material Management Actions
Below the Pieces Copilot actions, you can easily change a snippet’s name, description, classification, and other enriched metadata—view them in the table below.
| Add, adjust or delete annotations for the snippet. |
---|---|
| Add or remove links to the snippet’s metadata. |
| Add or remove tags to the snippet’s metadata. |
| Set your own custom snippet classification. |
| Edit the content of the snippet. |
| Change the name (title) of the snippet as it appears in your repository of saved materials. |
| Delete the snippet. |
Additional Tools while Editing
Layers upon layers of functionality—that’s the goal of all Pieces for Developers plugins and extensions.
When you edit a snippet (by right-clicking it from the Pieces Explorer menu and clicking Edit
), every single bit of Pieces functionality is available to you, even though you are in a view that’s removed from your main file.
Instead, the Edit
view becomes your main file, so you can generate code comments, debug, refactor the code, add it to context, and more.