doc/user/project/repository/code_suggestions/set_up.md
You can use GitLab Duo Code Suggestions in several different IDEs.
To set up Code Suggestions, follow the instructions for your IDE.
To use Code Suggestions, you need:
Code Suggestions is part of an editor extension. To use Code Suggestions:
Follow these steps for your IDE:
gitlab.vim plugin for NeovimCode Suggestions is turned on if you meet the prerequisites. To confirm, open your IDE and verify if Code Suggestions works.
To verify that Code Suggestions is turned on in VS Code:
To verify that Code Suggestions is turned on in Visual Studio:
To verify that Code Suggestions is turned on in JetBrains IDEs:
{{< history >}}
{{< /history >}}
GitLab Duo attempts to detect trusted root certificates without configuration on your part. If needed, configure your JetBrains IDE to allow the GitLab Duo plugin to use a custom SSL certificate when connecting to your GitLab instance.
To use a custom SSL certificate with GitLab Duo:
If your IDE detects a non-trusted SSL certificate:
To review certificates you've already accepted:
[!note] To enable GitLab Duo Code Suggestions, open an Eclipse project. If you open a single file, Code Suggestions is disabled for all file types.
To verify that Code Suggestions is turned on in Eclipse:
Code Suggestions displays as "Enabled".
Code Suggestions provides a LSP (Language Server Protocol) server, to support the built-in <kbd>Control</kbd>+<kbd>x</kbd>, <kbd>Control</kbd>+<kbd>o</kbd> Omni Completion key mapping:
| Mode | Key mappings | Type | Description |
|---|---|---|---|
INSERT | <kbd>Control</kbd>+<kbd>x</kbd>, <kbd>Control</kbd>+<kbd>o</kbd> | Built-in | Requests completions from GitLab Duo Code Suggestions through the language server. |
NORMAL | <Plug>(GitLabToggleCodeSuggestions) | <Plug> | Toggles Code Suggestions on or off for the current buffer. Requires configuration. |
All editor extensions from GitLab, except Neovim, add an icon to your IDE's status bar. For example, in Visual Studio:
| Icon | Status | Meaning |
|---|---|---|
| {{< icon name="tanuki-ai" >}} | Ready | You've configured and enabled GitLab Duo, and you're using a language that supports Code Suggestions. |
| {{< icon name="tanuki-ai-off" >}} | Not configured | You haven't entered a personal access token, or you're using a language that Code Suggestions doesn't support. |
| Loading suggestion | GitLab Duo is fetching Code Suggestions for you. | |
| Error | GitLab Duo has encountered an error. |
The process for turning off Code Suggestions is different for each IDE.
[!note] You cannot turn off code generation and code completion separately.
To turn off Code Suggestions in VS Code:
Instead, you can set gitlab.duoCodeSuggestions.enabled to false in the VS Code settings.json file.
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.
The process to disable GitLab Duo, including Code Suggestions, is the same regardless of which JetBrains IDE you use.
For more information, see the JetBrains product documentation.
To disable Eclipse Code Suggestions for a project:
To disable Eclipse Code Suggestions for a specific language:
Go to the Neovim defaults.lua settings file.
Under code_suggestions, change the enabled = flag to false:
code_suggestions = {
...
enabled = false,
Alternatively, you can turn off GitLab Duo (which includes Code Suggestions) completely for a group, project, or instance.