Get started with GitLab Duo Code Suggestions

GitLab Duo is an AI-powered enhancement integrated into the GitLab DevSecOps platform, designed to boost productivity and efficiency. It leverages advanced large language models (LLMs) from Google Vertex AI and Anthropic Claude to provide various AI-driven features. These features operate independently, ensuring that the core functionality of GitLab remains unaffected even if an AI feature encounters issues.

GitLab Duo Code Suggestions helps you write code more efficiently by using generative AI to suggest code while you’re developing.

Step 1: Understand how Code Suggestions works

Code Suggestions is made up of code completion and code generation. These are two distinct features that help developers write code more efficiently:

  Code completion Code generation
Purpose Provides suggestions for completing the current line of code. Generates new code based on a natural language comment.
Trigger Triggers when typing, usually with a short delay. Triggers when pressing Enter after writing a comment that includes specific keywords.
Scope Limited to the current line or small block of code. Can generate entire methods, functions, or even classes based on the context.
Accuracy More accurate for simple tasks and short blocks of code. Can be more accurate for complex tasks and large blocks of code due to its ability to analyze context and use a larger language model.
When to use Use code completion for quick tasks, small code snippets, or when you need a slight boost in productivity. Use code generation for more complex tasks, larger codebases, or when you want to write new code from scratch based on a natural language description.

Step 2: Supported languages, text editors and IDEs

To ensure your preferred tooling is supported, review the:

Supported languages Supported editors

Step 3: Enable Code Suggestions

First, purchase seats for GitLab Duo.

Then, assign seats to users to grant access to GitLab Duo for:

Step 4: Using Code Suggestions

Follow the documentation to use Code Suggestions.

Step 5: Troubleshooting common challenges

Troubleshoot commonly faced challenges.