Context
Positron Assistant goes beyond reading your code files; it accesses your loaded data, plots, and Console activity by calling tools and executing code in your R or Python interpreter session or running commands in the Terminal.
This access allows Assistant to provide more relevant coding guidance based on:
- In-memory data: Names, dimensions, and column names of dataframes, plus metadata for arrays, lists, and other objects in memory
- Current plot: The most recent plot in the Plots pane
- Console history: Code inputs and outputs, with the ability to execute new code and see results
- Workspace information: Project structure, files, and version control history
Attach context
Providing useful context to Positron Assistant is crucial for getting accurate and relevant responses.
By default, the active editor file and the active interpreter session (if any) are attached as context for your chat messages in the chat pane.
To include additional attachments as context for your prompts:
- Click the paperclip button in the chat pane
- Choose from options such as:
- Files & Folders: specific files or folders in your workspace.
- Source Control: commits from your version control history.
- Tools: specific tools you would like Assistant to use.
For more information on attaching context to your chat message, refer to the Add context to your prompt VS Code documentation.
Interpreter session context
By default, Positron Assistant can see the active R or Python interpreter session in the chat pane. The Chat input box displays the active Console session as an attachment.
When an interpreter session is attached, Positron Assistant can access:
- Code inputs and outputs in that session
- In-memory objects and dataframes in the Variables pane
- The active plot in the Plots pane
- Tool calls that require the interpreter session
Switch the attached interpreter session
- Click the interpreter session in the Console pane to make it active.
- Positron Assistant automatically updates to use the newly active interpreter session.
Toggle the visibility of the active interpreter session
In the chat pane, click the eye button on the interpreter session attachment to toggle whether Assistant can access the session data.
- : When the eye icon appears without a slash through it, the interpreter session is visible.
- : When the eye icon has a slash through it, the interpreter session is hidden.
Manually attach an interpreter session
- Click the paperclip button in the chat pane
- Choose “Interpreter Sessions…” to select an interpreter session to attach.
Source control context
If your workspace uses Git source control, Positron Assistant can access your commit history and generate commit messages in the Source Control pane.
Commit history context
Include commit history in your chat session in the following ways:
- Add context attachments and select “Source Control…” to attach a commit.
- Include the text
#changesas part of your prompt, to include recent changes on the current branch.
Generate commit messages
From the Source Control pane, you can use Positron Assistant to generate commit messages for your staged changes.
- Open the Source Control pane (Source Control: Focus on Changes View in the Command Palette).
- Ensure you have staged changes to commit.
- Click the sparkles icon in the commit message input box.
- Positron Assistant will analyze your staged changes and generate a commit message.
Settings
chat.implicitSessionContext.enabled: Configure whether Positron Assistant automatically attaches the active interpreter session in the chat pane.- To disable the interpreter session context in the chat pane by default, change the configuration for
paneltonever. You will still be able to Manually attach an interpreter session if needed.
- To disable the interpreter session context in the chat pane by default, change the configuration for
chat.implicitContext.enabled: Configure whether Positron Assistant automatically attaches the active editor in the chat pane.- To disable the active editor context in the chat pane by default, change the configuration for
paneltonever. You will still be able to manually Add context attachments for files if needed.
- To disable the active editor context in the chat pane by default, change the configuration for
positron.assistant.gitIntegration.enable: Configure whether Positron Assistant can access Git source control context, such as commit history, and whether commit messages can be generated in the Source Control pane.