Sharing Snippets

The Share via Pieces Link feature in the Pieces for JetBrains Plugin is designed to streamline the process of sharing code snippets with colleagues, collaborates, or the broader development community.

This feature lets users generate shareable links for their saved code snippets directly from within their JetBrains IDE without needing to switch to the Pieces for Developers Desktop App.


What Information Gets Shared

When a snippet is saved to the Pieces Cloud, the code is enriched with valuable information such as related people, links, annotations, tags, and an automatically-generated description.

This information is visible to the right of the code block when the shared snippet is open in your browser:

Want to see what a shared snippet looks like for yourself?

Click here to check out a C# snippet that Pieces engineers used to launch a Confetti Cannon at a conference.

How to Share Snippets

There are a couple of ways to share saved snippets with the Pieces for JetBrains Plugin—namely selecting unsaved code and using keyboard shortcuts, right-clicking a saved snippet from the snippet window, or right-clicking highlighted code and selecting the Share via Pieces Link option.

via Right-Click Menu

Shareable Pieces links for your code snippets can also be generated by right-clicking a portion of selected code, hovering over the Pieces item in the pop-up menu, then selecting Share via Pieces Link.

via Keyboard Shortcut

You can share code snippets using the ⌘+L (macOS) or ctrl+L (Windows/Linux) when you've highlighted code that has not yet been saved as a snippet. This is simply a shortcut to accessing the Share via Pieces Link tool in the right-click menu.

via JetBrains Toolbar

If you click the Pieces icon in your JetBrains IDE’s toolbar, you’ll find a list of saved snippets that are shown relative to the language you are currently working with. This is based on the code in the active file on your screen.

Right-click a snippet from the list of available saved snippets, then use either the keyboard shortcut mentioned above—⌘+L (macOS) or ctrl+L (Windows/Linux)—or right-click and select Share via Pieces Link.

Sensitive Information Watchdog

The Share via Pieces Link feature does more than just allow you to effectively share snippets across your entire team and other communities, though.

You'll see a section titled Sensitive Information:

Our in-house ML model scans snippets for potentially sensitive information, like API keys or passwords, and alerts you so that you can make an informed decision before sharing the snippet.  

The scan happens locally using on-device machine learning models before the snippet is uploaded to the cloud for sharing—that way, you can make an informed decision about sharing your code.

Updated on