Cody completions

Example of Cody completions. You see a code snippet starting with async function getWeather(city: string) { and Cody response with a multi-line suggestion using a public weather API to return the current weather

What are Cody completions?

Cody provides real-time code completions as you're typing. As you start coding, or after you type a comment, Cody will look at the context around your open files and file history to predict what you're trying to implement and provide completions. It's autocomplete powered by Cody!

Enabling Cody completions

While in experimental state, Cody completions need to be enabled manually. To do that:

  1. Make sure your Cody AI by Sourcegraph extension is on the latest version
    • shift+cmd+x to see all extensions, select Cody, confirm the version
  2. Go to the Cody Extension Settings and enable completions
    • Click to check the box for: Cody > Experimental Suggestions
  3. Finally, restart or reload VS Code and test it out!

Configuring on Sourcegraph Enterprise

Please follow the steps in Enabling Cody on Sourcegraph Enterprise to enable Cody on Sourcegraph Enterprise.

You have to configure the model used for Cody completions via the completionModel option inside the completions site config.

{
  // [...]
  "completions": {
    "enabled": true,
    "provider": "anthropic",
    "completionModel": "claude-instant-v1.0",
    "accessToken": "<key>"
  }
}