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 a Saved Snippet
You can share saved snippets in two ways: use keyboard shortcuts or right-click on a selection in your environment.
This link can easily be shared via email, Discord, Slack, or other platforms. The recipient can view the snippet without needing to have a Pieces account.
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). This is simply a shortcut to accessing the Share via Pieces Link
tool in the right-click menu.
Generating Links for Existing Saved Snippets
If you saved a material but didn't create a shareable link at the time, don't worry. You can still generate, copy, regenerate, or delete the existing link from the Pieces Drive.
Open the Pieces Drive
Open the Pieces Drive via the Pieces Drive icon in the JetBrains sidebar.
Share the Snippet
After locating the snippet you’d like to share, right-click it and select Generate Shareable Link
from the available actions.
Wait for the Link and Copy
After generating the link, a new modal will appear. Wait for the snippet to be shared with an automatically generated link, or manually copy the link from the modal.
If you have generated a link for that snippet previously, the More Actions
menu options will automatically adjust to include 3 new actions:
-
Open in Browser
: Opens the existing shareable link in your desired browser. -
Refresh Link
: Regenerates the link—this is important if a snippet has been edited or updated, as a new link will be required to contain the new changes. -
Revoke Link
: Revokes the shareable link so that anyone with the existing link to that snippet will be barred from future access.
Enriched Sharing Experience
When you Share
a snippet, it’s not just the code that’s included. The snippet comes with additional metadata to provide context—you can read more about that here.
-
Snippet Type
: Identify the language or framework, such as Python or React. -
Tags
: Useful keywords for quick categorization. -
Description
: A short summary of what the snippet does. -
Related Links
: Helpful resources or documentation tied to the snippet. -
Author Information
: A record of who created the snippet.
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.