---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.6
alternate:
  - https://sourcecraft.dev/portal/docs/en/code-assistant/operations/chat-context.md
  - https://sourcecraft.dev/portal/docs/ru/code-assistant/operations/chat-context.md
title: Managing chat context in SourceCraft Code Assistant
description: How to manage chat context in Code Assistant.
---
> **Documentation Index:** Fetch the complete configuration index at https://sourcecraft.dev/portal/docs/en/llms.txt


# Managing SourceCraft Code Assistant chat context in the JetBrains IDE

{% note warning %}

This page describes the chat context features in the JetBrains IDE. For the chat context features in Visual Studio Code, see [Managing SourceCraft Code Assistant chat context in Visual Studio Code](https://sourcecraft.dev/portal/docs/en/code-assistant/operations/agent/context-mentions.md).

{% endnote %}

_Context_ is auxiliary information that Code Assistant uses to generate relevant and consistent chat responses.

## Adding information to context {#add-to-context}

1. <!-- source: en/_includes/code-assistant/open-chat-jb.md -->
   In the editor's right-hand panel, click <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path fill="#868686" d="M21 23H2l.9-4.5h1.53l-.6 3h15.94l1.2-6H21L22.5 8H24l-3 15Zm-2.75-7h-6l-3.375 3L7 16H0L3 1h18.25l-3 15ZM1.83 14.5h6l.441.705.934 1.493 2.048-1.82.426-.378h5.34l2.4-12H4.23l-2.4 12Zm7.17-2H7l5.5-8h2l-5.5 8Z"/></svg> **SourceCraft Code Assistant Chat**.
   <!-- endsource: en/_includes/code-assistant/open-chat-jb.md -->
1. In the message input window, click <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="currentColor" fill-rule="evenodd" d="M8 2.5a5.5 5.5 0 1 0 3.52 9.727.75.75 0 0 1 .96 1.152A7 7 0 1 1 15 8a2.5 2.5 0 0 1-4.083 1.935A3.5 3.5 0 1 1 11.5 8a1 1 0 1 0 2 0A5.5 5.5 0 0 0 8 2.5M10 8a2 2 0 1 0-4 0 2 2 0 0 0 4 0" clip-rule="evenodd"/></svg> **Add Files and Folders to Context**.
1. Select a file or directory.

    {% note warning %}

    When you select a directory, only its top-level files will be included in the context.

    {% endnote %}

## Viewing the current context {#current-context}

In the message input window, click <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="currentColor" fill-rule="evenodd" d="m9.77 10.73.01-.01 3.08-3.08a3.889 3.889 0 1 0-5.5-5.5L4.73 4.77l-.01.01-1.667 1.666a5.303 5.303 0 0 0 7.5 7.5l3.167-3.166a.75.75 0 1 0-1.061-1.06l-3.166 3.166a3.803 3.803 0 1 1-5.379-5.379L5.33 6.291l.011-.01L8.421 3.2a2.39 2.39 0 0 1 3.38 3.378l-1.13 1.13-.012.012-2.995 2.994a.975.975 0 1 1-1.378-1.378L9.28 6.34a.75.75 0 0 0-1.06-1.06L5.225 8.274a2.475 2.475 0 0 0 3.5 3.5z" clip-rule="evenodd"/></svg>.

## Viewing used context {#used-context}

Below the title of your message (**Me**), click <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="currentColor" fill-rule="evenodd" d="M5.47 13.03a.75.75 0 0 1 0-1.06L9.44 8 5.47 4.03a.75.75 0 0 1 1.06-1.06l4.5 4.5a.75.75 0 0 1 0 1.06l-4.5 4.5a.75.75 0 0 1-1.06 0" clip-rule="evenodd"/></svg> to the right of **Used references**.

#### Useful links {#see-also}

* [Getting started with SourceCraft Code Assistant](https://sourcecraft.dev/portal/docs/en/code-assistant/index.md)
* [SourceCraft Code Assistant overview](https://sourcecraft.dev/portal/docs/en/code-assistant/concepts/index.md)
* [SourceCraft Code Assistant chat interface in the JetBrains IDE](https://sourcecraft.dev/portal/docs/en/code-assistant/operations/chat.md)
* [Quick actions in SourceCraft Code Assistant](https://sourcecraft.dev/portal/docs/en/code-assistant/operations/quick-actions.md)