gemini-cli

IDE Integration

Gemini CLI can integrate with your IDE to provide a more seamless and context-aware experience. This integration allows the CLI to understand your workspace better and enables powerful features like native in-editor diffing.

Currently, the only supported IDE is Visual Studio Code and other editors that support VS Code extensions. To build support for other editors, see the IDE Companion Extension Spec.

Features

Installation and Setup

There are three ways to set up the IDE integration:

When you run Gemini CLI inside a supported editor, it will automatically detect your environment and prompt you to connect. Answering “Yes” will automatically run the necessary setup, which includes installing the companion extension and enabling the connection.

2. Manual Installation from CLI

If you previously dismissed the prompt or want to install the extension manually, you can run the following command inside Gemini CLI:

/ide install

This will find the correct extension for your IDE and install it.

3. Manual Installation from a Marketplace

You can also install the extension directly from a marketplace.

NOTE: The “Gemini CLI Companion” extension may appear towards the bottom of search results. If you don’t see it immediately, try scrolling down or sorting by “Newly Published”.

After manually installing the extension, you must run /ide enable in the CLI to activate the integration.

Usage

Enabling and Disabling

You can control the IDE integration from within the CLI:

When enabled, Gemini CLI will automatically attempt to connect to the IDE companion extension.

Checking the Status

To check the connection status and see the context the CLI has received from the IDE, run:

/ide status

If connected, this command will show the IDE it’s connected to and a list of recently opened files it is aware of.

(Note: The file list is limited to 10 recently accessed files within your workspace and only includes local files on disk.)

Working with Diffs

When you ask Gemini to modify a file, it can open a diff view directly in your editor.

To accept a diff, you can perform any of the following actions:

To reject a diff, you can:

You can also modify the suggested changes directly in the diff view before accepting them.

If you select ‘Yes, allow always’ in the CLI, changes will no longer show up in the IDE as they will be auto-accepted.

Using with Sandboxing

If you are using Gemini CLI within a sandbox, please be aware of the following:

Troubleshooting

If you encounter issues with IDE integration, here are some common error messages and how to resolve them.

Connection Errors

Configuration Errors

General Errors