Code Suggestions All tiers All offerings Beta

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.

GitLab Duo Code Suggestions are available:

  • On self-managed and SaaS.
  • In VS Code, Microsoft Visual Studio, JetBrains IDEs, and Neovim. You must have the corresponding GitLab extension installed.
  • In the GitLab WebIDE.

Usage of Code Suggestions is governed by the GitLab Testing Agreement. Learn about data usage when using Code Suggestions.

Supported languages

The best results from Code Suggestions are expected for languages the Google Vertex AI Codey APIs directly support:

  • C++
  • C#
  • Go
  • Google SQL
  • Java
  • JavaScript
  • Kotlin
  • PHP
  • Python
  • Ruby
  • Rust
  • Scala
  • Swift
  • TypeScript

Supported code infrastructure interfaces

Code Suggestions includes Google Vertex AI Codey APIs support for the following infrastructure as code interfaces:

  • Google Cloud CLI
  • Kubernetes Resource Model (KRM)
  • Terraform

Suggestion quality for other languages and using natural language code comments to request completions may not yet result in high-quality suggestions.

Supported languages in IDEs

Editor support for languages is documented in the following table.

LanguageVS CodeJetBrains IDEsVisual StudioNeovim
C++ Yes No Yes Yes
C# Yes Yes Yes Yes
Go Yes Yes (IDEA Ultimate / GoLand) Yes Yes
Google SQL No No Yes Yes
Java Yes Yes Yes Yes
JavaScript Yes Yes Yes Yes
Kotlin Yes Yes Yes Yes
PHP Yes Yes (IDEA Ultimate) Yes Yes
Python Yes Yes Yes Yes
Ruby Yes Yes (IDEA Ultimate / RubyMine) 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) No No Yes (Requires third-party extension providing the terraform file type)

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 a generative artificial intelligence (AI) model.

Your personal access token enables a secure API connection to GitLab.com. This API connection securely transmits a context window from your IDE/editor to the Code Suggestions GitLab hosted service which calls Google Vertex AI Codey APIs, and the generated suggestion is transmitted back to your IDE/editor.

GitLab currently leverages Google Cloud’s Vertex AI Codey API models. Learn more about Google Vertex AI Codey APIs Data Governance.

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 currently inferences against the currently opened file and has a context window of 2,048 tokens and 8,192 character limits. This limit includes content before and after the cursor, the file name, and the extension type. Learn more about Google Vertex AI code-gecko.

The maximum number of tokens that is generated in the response is default 64. A token is approximately four characters. 100 tokens correspond to roughly 60-80 words. Learn more about Google Vertex AI code-gecko.

Training data

Code Suggestions are routed through Google Vertex AI Codey APIs. Learn more about Google Vertex AI Codey APIs Data Governance and Responsible AI.

Google Vertex AI Codey APIs are not trained on private non-public GitLab customer or user data.

Google has shared the following about the data Codey models are trained on:

Codey is our family of foundational coding models built on PaLM 2. Codey was fine-tuned on a large dataset of high quality, permissively licensed code from external sources

Progressive enhancement

This feature is designed as a progressive enhancement to developer’s IDEs. Code Suggestions offer a completion if the machine learning engine can generate a recommendation. 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.

Internet connectivity

Code Suggestions does not work with offline environments.

To use Code Suggestions:

  • On GitLab.com, you must have an internet connection and be able to access GitLab.
  • In GitLab 16.1 and later, on self-managed GitLab, you must have an internet connection.

Model accuracy and quality

Code Suggestions can generate low-quality, incomplete, and possibly insecure code. We strongly encourage all beta users to leverage GitLab native Code Quality Scanning and Security Scanning capabilities.

GitLab currently does not retrain Google Vertex AI Codey APIs. GitLab makes no claims to the accuracy or quality of Code Suggestions generated by Google Vertex AI Codey API. Read more about Google Vertex AI foundation model capabilities.

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

We are also aware of specific situations that can produce unexpected or incoherent results including:

  • Suggestions written in the middle of existing functions, or “fill in the middle.”
  • Suggestions based on natural language code comments.
  • Suggestions that mixed programming languages in unexpected ways.

Feedback

Report issues in the feedback issue.