Use Cody, the AI coding assistant, plus Code Search directly from your JetBrains IDE.
- Cody is an AI coding assistant that helps you understand, write, and fix code faster. It uses advanced search to pull context from both local and remote codebases so that you can use context about APIs, symbols, and usage patterns from across your entire codebase at any scale, all from within your JetBrains IDE.
- Code Search lets you search code across all your repositories and code hosts—even the code you don’t have locally.
Designed to simplify and accelerate developer workflows, Sourcegraph uses intent detection and a combination of search, AI chat, and prompts in a single interface to streamline how you explore, understand, and generate code.
Streamline your development process by using prompts to understand, improve, fix, document, and generate unit tests for your code. You can also create your own prompts and save them in the Prompt Library to tailor Sourcegraph to your workflow.
Autocompletes single lines, or whole functions, in any programming language, configuration file, or documentation. It’s powered by the latest instant LLM models, for accuracy and performance.
Sourcegraph is available on the IDEs you use today. Get AI chat, autocomplete, and inline edit without changing your workflow.
When tools focus solely on individual productivity, teams face inconsistent and poor-quality results. Sourcegraph focuses on team productivity using whole codebase context and shared prompts to ensure quality and consistency across your enterprise.
Sourcegraph users can select the LLM they want to use for chat and experiment to choose the best model for the job. Choose from multiple options including Claude 3.5 Sonnet, Gemini 1.5 Pro, and Mixtral 8x7B. Cody Pro users can also select Claude 3 Opus and GPT-4o. See the full list of model options here.
Cody users can select the LLM they want to use for chat and experiment to choose the best model for the job. Choose from multiple options including Claude 3.5 Sonnet, Gemini 1.5 Pro, and Mixtral 8x7B. Cody Pro users can also select Claude 3 Opus and GPT-4o. See the full list of model options here.
Administrators for Sourcegraph Enterprise instances can configure which model options to let team members choose from.
Sourcegraph is built to support the needs of the largest enterprises, with flexible deployment and support for enterprise security and compliance.
This extension works for all Cody plans, including Cody Free, Cody Pro, and Cody Enterprise.
You can find detailed information about Cody's available plans on our website.
Cody works for any programming language because it uses LLMs trained on broad data. Cody works great with Python, Go, JavaScript, and TypeScript code.
Contact us to set up a trial of Cody Enterprise. If you’re an existing Sourcegraph Enterprise customer, contact your technical advisor.
Cody's code is open source (Apache License 2.0).
- Search with Sourcegraph directly from inside the IDE
- Instantly search in all open source repos and your private code
- Peek into any remote repo in the IDE, without checking it out locally
- Create URLs to specific code blocks to share them with your teammates
- Open your files on Sourcegraph
The plugin works with all JetBrains IDEs, including:
- IntelliJ IDEA
- IntelliJ IDEA Community Edition
- PhpStorm
- WebStorm
- PyCharm
- PyCharm Community Edition
- RubyMine
- AppCode
- CLion
- GoLand
- DataGrip
- Rider
- Android Studio
Versions 2022+ Recommended
Exception: Due to a Java bug, search doesn't work with IDE versions 2021.1 and 2021.2 for users with Apple Silicone CPUs.
- Open settings
- Windows: Go to
File | Settings
(or use Ctrl+Alt+S) - Mac: Go to
IntelliJ IDEA | Preferences
(or use ⌘,)
- Windows: Go to
- Click
Plugins
in the left-hand pane, then theMarketplace
tab at the top - Search for
Sourcegraph
, then click theInstall
button - Make sure that the
git
command is available in your PATH. We’re going to get rid of this dependency, but for now, the plugin relies on it. - Restart your IDE if needed
- To search with Sourcegraph, press Alt+S (⌥S on Mac).
- To share a link to your code or search through the website, right-click in the editor, and choose an action under
the
Sourcegraph
context menu item. - To use your private Sourcegraph instance, open
Settings | Tools | Sourcegraph
and enter your URL and access token.
- Authorization: List of accounts that can be used to interact with the plugin. Each account can be configured with:
- Server: The URL of your Sourcegraph instance. It can be configured with your private instance if you're adding an enterprise account.
- Token: See our user docs for a video guide on how to create an access token.
- Custom request headers: Any custom headers to send with every request to Sourcegraph.
- Use any number of pairs:
header1, value1, header2, value2, ...
. - Example:
Authorization, Bearer 1234567890, X-My-Header, My-Value
. - Whitespace around commas doesn't matter.
- Use any number of pairs:
- Default branch name: The branch to use if the current branch is not yet pushed to the remote.
- Usually "main" or "master", but can be any name
- Remote URL replacements: You can replace specific strings in your repo's remote URL.
- Use any number of pairs:
search1, replacement1, search2, replacement2, ...
. - Pairs are replaced from left to right. Whitespace around commas doesn't matter.
- Important: The replacements are done on the Git remote-formatted URL, not the URL you see in the browser!
- Example replacement subject for Git:
[email protected]:sourcegraph/sourcegraph.git
- Example replacement subject for Perforce:
[email protected]:depot-name.perforce
- Anatomy of the replacement subjects:
- The username is not used.
- Between the
@
and the:
is the hostname - After the
:
is the organization/repo name (for Git) or the depot name (for Perforce) - The
.git
/.perforce
extension is not used.
- When you do the replacements, make sure you keep the colon.
- In the case of a custom
repositoryPathPattern
being set for your code host in your private Sourcegraph instance, you may try to set up a pattern that uses the@
,:
, and.git
/.perforce
boundaries, or specify a replacement pair for each repo or each depot you may have. If none of these solutions work for you, please raise this at [email protected], and we'll prioritize making this more convenient.
- Example replacement subject for Git:
- Use any number of pairs:
- Globbing: Determines whether you can specify sets of filenames with wildcard characters.
- Cody completions: Enables/disables Cody completions in the editor.
- The completions are disabled by default.
By default, the plugin will use the git remote called origin
to determine which repository on Sourcegraph corresponds
to your local repository. If your origin
remote doesn't match Sourcegraph, you may instead configure a Git remote by
the name of sourcegraph
. It will take priority when creating Sourcegraph links.
You can configure the plugin on three levels:
- Project-level On the project level you are able to configure your default account, default branch name and remote url replacements
- Application-level All other settings are stored here
In order to disable newly introduced features we are giving an option to disable them via system properties:
- Disable formatting autocomplete elements
cody.autocomplete.enableFormatting=false
You can configure JetBrains to set custom keymaps for Sourcegraph actions:
- Open the JetBrains preferences panel and go to the Keymap page.
- Filter by "sourcegraph" to see actions supplied by this plugin.
- Now select an option to overwrite the keymap information and supply the new bindings.
If you have any questions, feedback, or bug report, we appreciate if you open an issue on GitHub.
- Open settings
- Windows: Go to
File | Settings
(or use Ctrl+Alt+S) - Mac: Go to
IntelliJ IDEA | Preferences
(or use ⌘,)
- Windows: Go to
- Click
Plugins
in the left-hand pane, then theInstalled
tab at the top - Find
Sourcegraph
→ Right click →Uninstall
(or uncheck to disable)