ExperimentalInstall Cody for JetBrains
Learn how to use Cody and its features with the JetBrains IntelliJ editor.
The Cody extension by Sourcegraph enhances your coding experience in your IDE by providing intelligent code suggestions, context-aware completions, and advanced code analysis. This guide will walk you through the steps to install and set up the Cody within your JetBrains environment.
- You have the latest version of JetBrains IntelliJ installed
- You have enabled an instance for Cody from your Sourcegraph.com account
Install the JetBrains IntelliJ Cody extension
Follow these steps to install the Cody extension for JetBrains IntelliJ:
- Open JetBrains IntelliJ editor on your local machine
- Open "Settings" (Mac:
Ctrl+Alt+S) and select "Plugins"
- Type and search "Cody AI by Sourcegraph" extension and click "Install"
Alternatively, you can also Download and install the extension from the Jetbrains marketplace.
Connect the extension to Sourcegraph
After a successful installation, Cody's icon appears in the side bar. When you click it, you're asked to configure and add your Sourcegraph Access Token that helps you connect to a Sourcegraph instance (either an enterprise instance or Sourcegraph.com).
For Sourcegraph enterprise users
Log in to your Sourcegraph instance and go to
access token (
https://<your-instance>.sourcegraph.com/users/<your-instance>/settings/tokens). From here, generate a new access token.
Then, you select the option to
Use an enterprise instance and you will paste your access token and instance URL address in to the Cody extension.
For Sourcegraph.com users
Continue with Sourcegraph.com in the Cody extension. From there, you'll be taken to Sourcegraph.com, which will authenticate your extension.
Verifying the installation
Once connected, click the Cody icon from the sidebar again, and a panel will open. To verify that the Cody extension has been successfully installed and is working as expected:
- As you start typing, Cody should begin providing intelligent suggestions and context-aware completions based on your coding patterns and the context of your code
The Cody JetBrains IntelliJ extension also supports pre-built reusable prompts called "Commands" that help you quickly get started with common programming tasks like:
- Explain code
- Generate unit test
- Generate docstring
- Improve variable names
- Translate to different language
- Summarize recent code changes
- Detect code smells
- Generate release notes
Enable code graph context for context-aware answers (Optional)
You can optionally configure code graph content, which gives Cody the ability to provide context-aware answers. For example, Cody can write example API calls if has context of a codebase's API schema.
Learn more about how to:
- Configure code graph context for Sourcegraph.com
- Configure code graph context for Sourcegraph Enterprise
Updating the extension
JetBrains IntelliJ will typically notify you when updates are available for installed extensions. Follow the prompts to update the Cody extension to the latest version.
Read more about Cody capabilities to learn about all the features it provides to boost your development productivity.
For more information on what to do next, we recommend the following resources: