Code Suggestions

caution
This feature is in Beta. Beta users should read about the known limitations. We look forward to hearing your feedback.

Write code more efficiently by using generative AI to suggest code while you’re developing.

With Code Suggestions, you get:

  • Code Completion, which suggests completions the current line you are typing. These suggestions are usually low latency.
  • Code Generation, which generates code based on a natural language code comment block. Generating code can exceed multiple seconds.

Start using Code Suggestions

GitLab Duo Code Suggestions are available:

  • On self-managed and SaaS. View these pages to get started.
  • In VS Code, Microsoft Visual Studio, JetBrains IDEs, and Neovim. You must have the corresponding GitLab extension installed.
  • In the GitLab Web IDE.

During Beta, usage of Code Suggestions is governed by the GitLab Testing Agreement. Learn about data usage when using Code Suggestions. As Code Suggestions matures to General Availability it will be governed by our AI Functionality Terms.

Supported languages

Code Suggestions support is a function of the:

  • Underlying large language model.
  • IDE used.
  • Extension or plug-in support in the IDE.

For languages not listed in the following table, Code Suggestions might not function as expected.

Supported languages in IDEs

Editor support for languages is documented in the following table.

Language VS Code JetBrains IDEs Visual Studio Neovim
C++ Yes Yes Yes Yes
C# Yes Yes Yes Yes
Go Yes Yes Yes Yes
Google SQL No Yes Yes Yes
Java Yes Yes Yes Yes
JavaScript Yes Yes Yes Yes
Kotlin Yes Yes Yes Yes
PHP Yes Yes Yes Yes
Python Yes Yes Yes Yes
Ruby Yes Yes Yes Yes
Rust Yes Yes Yes Yes
Scala Yes Yes Yes Yes
Swift Yes Yes Yes Yes
TypeScript Yes Yes Yes Yes
Google Cloud No No No No
Kubernetes Resource Model (KRM) No No No No
Terraform Yes (Requires third-party extension providing Terraform support) Yes No Yes (Requires third-party extension providing the terraform file type)
note
Some languages are not supported in all JetBrains IDEs, or may require additional plugin support. Refer to the JetBrains documentation for specifics on your IDE.

Supported editor extensions

Code Suggestions supports a variety of popular editors including:

A GitLab Language Server for Code Suggestions is also in process. This improvement should result in:

  • Faster iteration and standardization of the IDE extensions.
  • The ability to use Code Suggestions even when an official editor extension isn’t available.

Code Suggestions data usage

Code Suggestions is powered by a generative AI model.

Your personal access token enables a secure API connection to GitLab.com or to your GitLab instance. This API connection securely transmits a context window from your IDE/editor to the GitLab AI Gateway, a GitLab hosted service. The gateway calls the large language model APIs, and then the generated suggestion is transmitted back to your IDE/editor.

GitLab selects the best-in-class large-language models for specific tasks. We use Google Vertex AI Code Models and Anthropic Claude for Code Suggestions.

View data retention policies.

Telemetry

For self-managed instances that have enabled Code Suggestions and SaaS accounts, we collect aggregated or de-identified first-party usage data through our Snowplow collector. This usage data includes the following metrics:

  • Language the code suggestion was in (for example, Python)
  • Editor being used (for example, VS Code)
  • Number of suggestions shown, accepted, rejected, or that had errors
  • Duration of time that a suggestion was shown
  • Prompt and suffix lengths
  • Model used
  • Number of unique users
  • Number of unique instances

Inference window context

Code Suggestions inferences against the currently opened file, the content before and after the cursor, the filename, and the extension type. For more information on possible future context expansion to improve the quality of suggestions, see epic 11669.

Training data

GitLab does not train generative AI models based on private (non-public) data. The vendors we work with also do not train models based on private data.

For more information on GitLab Code Suggestions data sub-processors, see:

Known limitations

While in Beta, we are working on improving the accuracy of overall generated content. However, Code Suggestions may generate suggestions that are:

  • Low-quality
  • Incomplete
  • Produce failed pipelines
  • Insecure code
  • Offensive or insensitive

Progressive enhancement

This feature is designed as a progressive enhancement to developer’s IDEs. Code Suggestions offer a completion if a suitable recommendation is provided to the user in a timely matter. In the event of a connection issue or model inference failure, the feature gracefully degrades. Code Suggestions do not prevent you from writing code in your IDE.

Feedback

Report issues in the feedback issue.