Related Snippets
The Related Snippets feature in the Pieces for VS Code Extension can surface snippets that are similar to the code you’re currently working on—even if you’ve never saved that snippet.
Finding Related Snippets
The Related Snippets feature uses Neural Code Search behind the scenes to find snippets you’ve saved that are structurally and semantically similar to the code in your current selection.
-
Right-click a portion of selected code
-
Hover over
Pieces
-
Select
Find Related
- You can then click one of the discovered snippets from the
Related Materials to Current Selection
tab in the Pieces Explorer.
Why Use Related Snippets?
By automatically surfacing related snippets, the Pieces for VS Code Extension helps developers make better use of their code libraries, reduce repetitive tasks, and create a more organized and consistent codebase tailored to their specific workflow.
Increased Code Reusability
With Pieces automatically identifying similar snippets—even those not originally saved in Pieces—you gain access to relevant code without needing to search or re-create it.
This saves time and effort, particularly in complex or large projects.
Streamlining your Coding Workflow
Related snippets appear in context, allowing you to pull from previous work and maintain your focus within the IDE.
By making useful code available right when you need it, this feature can help you code more efficiently without leaving your current environment—plus, it helps reduce context switching, which is always a productivity killer.
Consistent Code Quality
Pieces highlights similar code patterns, helping you keep code structure, syntax, and logic consistent throughout the project—that means less time spent on code documentation and maintenance.