Pieces Jetbrains Plugin

Using the Pieces for Developers JetBrains Plugin in combination with the Pieces Desktop App makes saving code simple from right inside your projects.

Search for Snippets with the JetBrains Plugin#

  1. Open up the Search Everywhere Window
  2. Double-tap the shift key and switch to the Pieces tab or Use the Ctrl+Shift+P ([⌘⇧P] on macOS) keyboard shortcut to open a tab focused solely on your Pieces snippets
  3. Your search parameters will return snippets that you've saved
  • You can also find saved snippets while searching in the 'All' tab, as results come from anywhere in your IDE

To view your snippets, just open the Pieces desktop app and scroll through the carousel.

Edit Snippets with the JetBrains Plugin#

Editing a snippet is super easy and can be done within your IDE without opening a separate window. When you edit, a new tab will open so that you can adjust the contents of your code snippet.

To open and edit a previously saved snippet:

  1. Select the snippet in the Pieces tool window
  2. Hit Alt+Enter (⌥⏎ on macOS) or right-click and select “Edit…” from the pop-up menu
  3. Make your changes
  4. Save the snippet using Ctrl+S (⌘S on macOS)
  • Additionally, you can adjust your snippet's name, description, and classification from this right-click context menu

View Saved Snippets with the JetBrains Plugin#

There are a few ways to view your full list of code snippets inside your IDE.

  • Right Click context menu:
    1. Right click in your editor
    2. Find "My Saved Pieces" inside the context menu that comes up
    3. When you hover over "My Saved Pieces," a pop out window will open on the side of the context menu, showing you a list of your saved code snippets
  • Sidebar Menu
    1. Find the Pieces for Developers Icon in the sidebar tray
    2. Select the Pieces Icon and a sidebar viewer will open with all of your snippets in a language-based list

The Sidebar Menu automatically expands the folder of language snippets that match the file where you're currently working.

Preview Saved Snippets in Markdown#

If you'd like to get a closer look at a snippet before adding it to your project, double-click on the snippet in the list view and it will open in a Markdown preview. You'll be able to see the snippet and its context, including any tags, descriptions, titles, related links, and related people.

As it's super easy to open several previews at once, we've also made it simple to close all of those tabs. Right-click on a snippet tab and select "Close All Snippets" to instantly close every snippet tab except for the one you're focused on.

Use Suggested Save in JetBrains#

Pieces can intelligently identify and save snippets based on re-use patterns in your JetBrains workflow. Whenever Pieces saves a snippet, you'll see a "Saved a Piece!" confirmation in the bottom right corner of your screen. Your snippet is now saved in Pieces with a default name and automatically classified by language.

To opt-out of Suggested Save, go to Preferences > Tools > Pieces and click on Suggested Save.

Refresh your Saved Snippets in your JetBrains IDE#

You can view your most recently saved snippets from the right-click context menu in JetBrains. To refresh that list after saving a new snippet:

  • Right-click in your code and select “Refresh Saved Pieces”

or

  • Click the refresh button located at the top of the sidebar view

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

Save Snippets & Files to Pieces from JetBrains#

To save an entire file to Pieces from your JetBrains IDE, simply highlight the snippet or file and save with:

  1. Keyboard Shortcut
  • Windows: CTRL + P(x2)
  • MacOS: CMD + P
  1. Right Click
  • Right Click and select "Save to Pieces"