Skip to content

Code Suggestions on GitLab SaaS

DETAILS: Tier: Free, Premium, Ultimate Offering: SaaS

Get started using Code Suggestions in your IDE. These instructions apply to users of GitLab SaaS.

Prerequisites:

To use Code Suggestions:

  1. Author your code. As you type, suggestions are displayed. Code Suggestions provide code snippets or completes the current line, depending on the cursor position.

  2. Describe the requirements in natural language. Code Suggestions generates functions and code snippets based on the context provided.

  3. To accept a suggestion, press Tab. To reject a suggestion, press Esc.

  4. To ignore a suggestion, keep typing as you usually would.

Best practices

To get the best results from code generation:

  • Be as specific as possible while remaining concise.
  • State the outcome you want to generate (for example, a function) and provide details on what you want to achieve.
  • Add additional information, like the framework or library you want to use.
  • Add a space or new line after each comment. This space tells the code generator that you have completed your instructions.

For example, to create a Python web service with some specific requirements, you might write something like:

# Create a web service using Tornado that allows a user to log in, run a security scan, and review the scan results.
# Each action (log in, run a scan, and review results) should be its own resource in the web service
...

AI is non-deterministic, so you may not get the same suggestion every time with the same input. To generate quality code, write clear, descriptive, specific tasks.

Enable Code Suggestions

  • Introduced in GitLab 15.11.
  • Moved from GitLab Ultimate to GitLab Premium in 16.0.
  • Moved from GitLab Premium to GitLab Free in 16.0.

Code Suggestions are enabled by default at the group level. This setting cascades to all subgroups and projects in the group.

To update this setting:

  1. On the left sidebar, select Search or go to and find your group.
  2. Select Settings > General.
  3. Expand Permissions and group features.
  4. Under Code Suggestions, select the Projects in this group can use Code Suggestions checkbox.
  5. Select Save changes.

If you have issues enabling Code Suggestions, view the troubleshooting guide.

Disable Code Suggestions for an individual user

To disable Code Suggestions, you can disable the feature in your IDE editor extension.