- Supported languages
- Enable Code Suggestions for an individual user
- Enable Code Suggestions in VS Code
- Enable Code Suggestions in other IDEs and editors
- Why aren’t Code Suggestions displayed?
- Stability and performance
- Code Suggestions data usage
- Progressive enhancement
- Known limitations
Code Suggestions (Beta)
- Introduced in GitLab 15.9 as Beta for early access Ultimate customers.
- Enabled as opt-in with GitLab 15.11 as Beta.
- Moved from GitLab Ultimate to GitLab Premium in 16.0.
- Moved from GitLab Premium to GitLab Free in 16.0.
- Enabled by default in GitLab 16.1.
Code Suggestions use generative AI to suggest code while you’re developing. Use Code Suggestions to write code more efficiently by viewing Code Suggestions as you type. Depending on the cursor position, the extension either:
- Provides entire code snippets, like generating functions.
- Completes the current line.
To accept a suggestion, press Tab.
Code Suggestions are available in Visual Studio Code when you have the GitLab Workflow extension installed. Additional IDE extension support is planned for the near future.
Code Suggestions may produce low-quality or incomplete suggestions.
The best results from Code Suggestions are expected for these languages:
Suggestions may be mixed for other languages. Using natural language code comments to request completions may also not function as expected.
Suggestions are best when writing new code. Editing existing functions or ‘fill in the middle’ of a function may not perform as expected.
We are making improvements to the Code Suggestions underlying AI model weekly to improve the quality of suggestions. Please remember that AI is non-deterministic, so you may not get the same suggestion week to week.
Usage of Code Suggestions is governed by the GitLab Testing Agreement. Learn about data usage when using Code Suggestions.
Enable Code Suggestions for an individual user
Introduced in GitLab 16.1 as Beta.
Each user can enable Code Suggestions for themselves:
- On the top bar, in the upper-right corner, select your avatar.
- On the left sidebar, select Preferences.
- In the Code Suggestions section, select Enable Code Suggestions.
- Select Save changes.
Enable Code Suggestions in VS Code
- Code Suggestions must be enabled for the top-level group.
- Code Suggestions must be enabled for your user account.
- If you use a personal access token,
the token must have the
To enable Code Suggestions in VS Code:
- Download and configure the GitLab Workflow extension for Visual Studio Code.
- In GitLab: Add Account to VS Code on Mac, add your GitLab work account to the VS Code extension:
- In macOS, press Shift + Command + P.
- In Windows, press Shift + Control + P.
You can Authenticate with OAuth to GitLab.com or you can use a personal access token.
To use OAuth (recommended):
GitLab: Authenticate with GitLab.com. It appears as a quick action. Select it.
- Follow the alert links to open a GitLab authorization URL in your browser.
- In your browser, select the alert to open the URL with VS Code.
To use a personal access token:
GitLab: Add Account to VS Code. It appears as a quick action. Select it.
- Provide your GitLab instance URL. A default is provided.
- Provide your personal access token.
- Regardless of the method you use to authenticate, after your GitLab account connects successfully, in the left sidebar, select Extensions.
- Find the GitLab workflow extension, select Settings (), and select Extension Settings.
- Enable GitLab > AI Assisted Code Suggestions.
Start typing and receive suggestions for your GitLab projects.
Enable Code Suggestions in other IDEs and editors
We have experimental support for Code Suggestions in Visual Studio, JetBrains, Neovim, Emacs, Sublime, etc.
More details in this blog.
Why aren’t Code Suggestions displayed?
If Code Suggestions are not displayed, try the following troubleshooting steps.
In GitLab, ensure Code Suggestions is enabled:
- For your user account.
- For all top-level groups your account belongs to. If you don’t have a role that lets you view the top-level group’s settings, contact a group owner.
In VS Code:
- Ensure your IDE is configured properly.
To confirm that your account is enabled, go to https://gitlab.com/api/v4/ml/ai-assist. A response of
user_is_allowed should return
Stability and performance
This feature is currently in Beta. While the Code Suggestions inference API operates completely within the GitLab.com enterprise infrastructure, we expect a high demand for this Beta feature, which may cause degraded performance or unexpected downtime of the feature. We have built this feature to gracefully degrade and have controls in place to allow us to mitigate abuse or misuse. GitLab may disable this feature for any or all customers at any time at our discretion.
Code Suggestions data usage
Code Suggestions is a generative artificial intelligence (AI) model hosted on GitLab.com.
Your personal access token enables a secure API connection to GitLab.com. This API connection securely transmits a context window from VS Code to the Code Suggestions ML model for inference, and the generated suggestion is transmitted back to VS Code.
Code Suggestions operate completely in the GitLab.com infrastructure, providing the same level of security as any other feature of GitLab.com, and processing any personal data in accordance with our Privacy Statement.
No new additional data is collected to enable this feature. The content of your GitLab hosted source code is not used as training data. Source code inference against the Code Suggestions model is not used to re-train the model. Your data also never leaves GitLab.com. All training and inference is done in GitLab.com infrastructure.
Read more about the security of GitLab.com.
Code Suggestions uses open source pre-trained base models from the CodeGen family including CodeGen-MULTI and CodeGen-NL. We then re-train and fine-tune these base models with a customized open source dataset to enable multi-language support and additional use cases. This customized dataset contains non-preprocessed open source code in 13 programming languages from The Pile and the Google BigQuery source code dataset. We then process this raw dataset against heuristics that aim to increase the quality of the dataset.
The Code Suggestions model is not trained on GitLab customer or user data.
This feature is designed as a progressive enhancement to developers 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.
Code Suggestions only work when you have internet connectivity and can access GitLab.com. Code Suggestions are not available for self-managed customers, nor customers operating within an offline environment.
Model accuracy and quality
While in Beta, 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 uses a customized open source dataset to fine-tune the model to support multiple languages. Based on the languages you code in, GitLab routes the request to a targeted inference and prompt engine to get relevant suggestions.
GitLab is actively refining these models to:
- Improve the quality of recommendations.
- Add support for more languages.
- Add protections to limit personal data, insecure code, and other unwanted behavior that the model may have learned from training data.
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
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.
Report issues in the feedback issue.