- Use Code Suggestions
- Supported languages
- Supported editor extensions
- Code Suggestions data usage
- Known limitations
- Introduced support for Google Vertex AI Codey APIs in GitLab 16.1.
- Removed support for GitLab native model in GitLab 16.2.
- Introduced support for Code Generation in GitLab 16.3.
Write code more efficiently by using generative AI to suggest code while you’re developing.
Code Suggestions supports two distinct types of interactions:
- 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.
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.
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 Availibility it will be governed by our AI Functionality Terms.
- Code Suggestions must be enabled for SaaS or for self-managed.
- You must have installed and configured a supported IDE editor extension.
To use Code Suggestions:
- Author your code. As you type, suggestions are displayed. Code Suggestions, depending on the cursor position, either provides code snippets or completes the current line.
- Describe the requirements in natural language. Be concise and specific. Code Suggestions generates functions and code snippets as appropriate.
- To accept a suggestion, press Tab.
- To ignore a suggestion, keep typing as you usually would.
- To explicitly reject a suggestion, press esc.
Things to remember:
- AI is non-deterministic, so you may not get the same suggestion every time with the same input.
- Just like product requirements, writing clear, descriptive, and specific tasks results in quality generated code.
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.
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.
Editor support for languages is documented in the following table.
|Language||VS Code||JetBrains IDEs||Visual Studio||Neovim|
|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 |
Code Suggestions supports a variety of popular editors including:
- VS Code, using the VS Code GitLab Workflow extension.
- GitLab WebIDE (VS Code in the Cloud), with no additional configuration.
- Microsoft Visual Studio, using the Visual Studio GitLab extension.
- JetBrains IDEs, using the GitLab plugin.
- Neovim, using the
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 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.
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
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.
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:
While in Beta, we are working on improving the accuracy of overall generated content. However, Code Suggestions may generate suggestions that are:
- Produce failed pipelines
- Insecure code
- Offensive or insensitive
Report issues in the feedback issue.