Accessing the Pieces Copilot Chat in JetBrains IDEs
There are several ways to open up the Pieces Copilot chat window in any JetBrains IDEs.
via Right-Click Context Menu
<Image src="https://storage.googleapis.com/hashnode_product_documentation_assets/jetbrains_plugin_assets/jetbrains_plugin_assets/pieces_copilot/chat/ask_about_selection.gif" alt="" align="center" fullwidth="true" />
via the Sidebar
<Image src="https://storage.googleapis.com/hashnode_product_documentation_assets/jetbrains_plugin_assets/jetbrains_plugin_assets/pieces_copilot/chat/add_context_and_ask.gif" alt="" align="center" fullwidth="true" />
via Keyboard Shortcuts
<Image src="https://storage.googleapis.com/hashnode_product_documentation_assets/jetbrains_plugin_assets/jetbrains_plugin_assets/pieces_copilot/chat/searching_for_snippet.gif" alt="" align="center" fullwidth="true" />
via AI Quick Actions
Use the AI Quick Actions feature in the Pieces for JetBrains Plugin to quickly get an explanation for a confusing or forgotten function's logic.
Try using the Pieces: Explain
tool above your code to start a conversation about a particular function.
This triggers the Copilot Chat window, which outputs an explanation and summary of the code function.

In addition, there is also Pieces: Comment
, which you can read more about here.
Contextualized Chats
You can utilize 2 different levels of contextual awareness when initiating a Copilot chat (or adding code to an existing chat) with the Pieces Copilot.
Ask Copilot About Selection
The Ask Copilot About Selection
command lets you interact with Copilot regarding specific code snippets, functions, or classes.
To use this feature:
<Image src="https://storage.googleapis.com/hashnode_product_documentation_assets/jetbrains_plugin_assets/jetbrains_plugin_assets/pieces_copilot/chat/ask_about_selection_command_pallete.png" alt="" align="center" fullwidth="true" />
This approach is ideal for localized queries requiring quick insights or guidance on specific code functionality.
Ask Copilot About Active File
The Pieces Ask About Active File
feature focuses on the current file, offering tailored insights and assistance with debugging.
There are two ways to access this command:
Right-click inside your file and select
Ask Copilot about File
, then type your query into the dropdown text input field.Open the command palette using
⌘+shift+p
(macOS) orctrl+shift+p
(Windows/Linux) and enterAsk About File
.
Once you've entered your question, the Pieces Copilot will analyze the file's context to deliver precise responses.

This feature helps you understand file dependencies, methods, and structure. It also detects potential issues, suggests improvements, and more.
Adding Context to Copilot Chats
You can add context to a chat by adding Files
, Folders
, Snippets
, Websites
, and Messages
.
This greatly boosts the number of generative AI responses you receive that will actually benefit you. It can provide hyper-specific responses because it’s contextually aware of your code.
To do this, select the Starred Message Icon in the bottom-left corner of your Copilot Chat window, which is openable from the JetBrains IDE sidebar.
Click the Starred Message Icon, then add whatever context items you need.

You can also right-click a file from your project or active file tree and add that file as context to the conversation.
This can be done without opening the Pieces Copilot window. Right-click on a file in your open project and select Add to Copilot Chat Context
.

Adding Code Snippets
You can paste snippets of code as a code block inside of any Copilot Chat by clicking the { }
icon inside the chat window, then pasting in your code.
This is useful for bringing in code that isn’t present immediately in the active file as context, or for comparisons and suggestions.

Extracting Code from Screenshots
You can also extract code from screenshots directly from the Copilot chat menu by selecting Extract Code from Screenshot
, selecting the desired screenshot from your Finder (macOS) or File Explorer (Windows/Linux) menu, and confirming.
Pieces Copilot will then scan the screenshot and generate the code captured from the image into the chat. You can copy, insert it at your cursor, save it as a snippet, and more.

AI Quick Actions
Above the functions in your code, you can find the clickable Pieces: Comment
and Pieces: Explain
buttons.
Click Pieces: Explain
to open up the Pieces Copilot in the side window. The Pieces Copilot will automatically explain the purpose and function of that code within the chat.
Similarly, you can click Pieces: Comment
above a function to have your preferred LLM generate documentation for that piece of code—you can then insert that code directly at the cursor by clicking Insert at Cursor
or save it as a snippet using the built-in Save to Pieces
button.

Improving Code Consistency & Standardization
The Pieces Copilot Chat is designed to assist you with various coding tasks to boost productivity and enhance your workflow. This is done primarily by eliminating context-switching (needing to leave your IDE to access generative AI).
Naming Inconsistencies
Suppose functions across your workspace use inconsistent naming patterns (e.g., authenticateUser
in authHandler.go
vs. retrieveUserProfile
in userHandler.go
). In that case, Pieces Copilot can suggest adopting a standardized naming convention for better readability and maintainability, like this:
// authHandler.go
func authenticateUser(ctx context.Context, credentials Credentials) (User, error) {
if credentials.Username == "" || credentials.Password == "" {
return User{}, errors.New("missing credentials")
}
}
Inconsistent Error Handling
If error-handling strategies differ across files (e.g., structured errors in authService.go
vs. inconsistent handling in userService.go
), Pieces Copilot can help unify the approach:
// authService.go
func LoginUser(credentials Credentials) (string, error) {
token, err := authenticate(credentials)
if err != nil {
return "", fmt.Errorf("login failed: %w", err)
}
return token, nil
}