Configure Code Suggestions
Before you can use Code Suggestions, you must set it up.
Set up Code Suggestions
Prerequisites:
- You should have the latest version of GitLab.
To set up Code Suggestions:
- Configure GitLab Duo.
- Check that your preferred language is supported.
- Configure your editor extension.
Configure GitLab Duo
-
Create a personal access token
with at least the
ai_features
scope. - Turn on GitLab Duo.
- Purchase the GitLab Duo Pro add-on subscription.
- Get a Duo Pro seat assigned to you, either individually or in bulk.
-
For GitLab self-managed, you must:
- Fulfill the prerequisites.
- Have GitLab 16.8 or later.
- Configure proxy settings.
For more information, see how to Get started with GitLab Duo.
Check language support
Code Suggestions supports a range of programming languages and development concepts.
Check that Code Suggestions supports your preferred language.
Different IDEs support different languages.
Configure editor extension
To use Code Suggestions, if you are not using the GitLab Web IDE, you must configure one of the following editor extensions to then use an equivalent IDE:
- GitLab Workflow for VS Code.
- Visual Studio GitLab Extension.
- GitLab Duo Plugin for JetBrains.
-
gitlab.vim
plugin for Neovim.
Regardless of the extension you use, you must:
- Install the extension in your IDE.
- Authenticate with GitLab from the IDE. You can use either OAuth or the personal access token you created when configuring GitLab Duo.
- Configure the extension.
GitLab Workflow for VS Code
Visual Studio GitLab extension
GitLab Duo plugin for JetBrains IDEs
gitlab.vim
plugin for Neovim
Turn off Code Suggestions
How you turn off Code Suggestions differs depending on which editor extension and IDE you use.
VS Code
To turn off Code Suggestions in the UI:
- In VS Code, go to Code > Settings > Extensions.
- Select Manage () > Settings.
- Clear the GitLab Duo Code Suggestions checkbox.
You can also set gitlab.duoCodeSuggestions.enabled
to false
in the VS Code settings.json
file.
Visual Studio
To turn Code Suggestions on or off without uninstalling the extension,
assign a keyboard shortcut to the GitLab.ToggleCodeSuggestions
custom command.
To disable or uninstall the extension, see the Microsoft Visual Studio documentation on uninstalling or disabling the extension.
JetBrains IDEs
The process to disable GitLab Duo, including Code Suggestions, is the same regardless of which JetBrains IDE you use.
- In your JetBrains IDE, go to settings and select the plugins menu.
- Under the installed plugins, find the GitLab Duo plugin.
- Disable the plugin.
For more information, see the JetBrains product documentation.
Neovim
- Go to the Neovim
defaults.lua
settings file. -
Under
code_suggestions
, change theenabled =
flag tofalse
:code_suggestions = { ... enabled = false,
Turn off GitLab Duo
Alternatively, you can turn off GitLab Duo (which includes Code Suggestions) completely for a group, project, or instance.