Enabling Cody with Sourcegraph.com

Cody uses Sourcegraph to fetch relevant context to generate answers and code. These instructions walk through installing Cody and connecting it to Sourcegraph.com. For private instances of Sourcegraph, see this page about enabling Cody for Enterprise.

Initial setup

  1. Create a Sourcegraph.com account
  2. Install the Cody VS Code extension
  3. Open the Cody extension in your editor and sign in with your Sourcegraph.com credentials
  4. When prompted by the extesnion, set the Sourcegraph URL to https://sourcegraph.com

You're now ready to use Cody in VS Code!

Configure code graph context for code-aware answers

After installing, you can optionally use code graph context to improve Cody's context of existing code. Note that code graph context is only available for public repositories on sourcegraph.com which have embeddings. See the list of repositories with embeddings and request any that you'd like to add by pinging a Sourcegraph team member in Discord.

If you want to use Cody with code graph context on private code, consider moving to a Sourcegraph Enterprise instance.

Enable code graph context

The Cody: Codebase setting in VS Code enables codebase-aware answers for the Cody extension. By setting this configuration option to the name of a repository with embeddings, Cody will be able to provide more accurate and relevant answers to your coding questions based on that repository's content.

  • Open the VS Code workspace settings by pressing Cmd/Ctrl+,, (or File > Preferences (Settings) on Windows & Linux).
  • Search for the Cody: Codebase setting.
  • Enter the repository name.
    • For example: github.com/sourcegraph/sourcegraph without the https protocol

Provide feedback

Please spread the word online and send us your feedback in Discord! Cody is open source and we'd love to hear from you if you have bug reports or feature requests.