Supported extensions and languages
DETAILS: Tier: Premium with GitLab Duo Pro or Ultimate with GitLab Duo Pro or Enterprise Offering: GitLab.com, Self-managed, GitLab Dedicated
Code Suggestions is available in the following editor extensions and for the following languages.
Supported editor extensions
To use Code Suggestions, use one of these editor extensions:
IDE | Extension |
---|---|
Visual Studio Code (VS Code) | GitLab Workflow for VS Code |
GitLab Web IDE (VS Code in the Cloud) | No configuration required. |
Microsoft Visual Studio (2022 for Windows) | Visual Studio GitLab extension |
JetBrains IDEs | GitLab Duo Plugin for JetBrains |
Neovim | gitlab.vim plugin |
A GitLab Language Server is used in VS Code, Visual Studio, and Neovim. The Language Server supports faster iteration across more platforms. You can also configure it to support Code Suggestions in IDEs where GitLab doesn't provide official support.
You can express interest in other IDE extension support in this issue.
Supported languages
Code Suggestions is aware of common popular programming languages, concepts, and infrastructure-as-code interfaces, like Kubernetes Resource Model (KRM), Google Cloud CLI, and Terraform.
Code Suggestions supports these languages:
Language | Web IDE | VS Code | JetBrains IDEs | Visual Studio 2022 for Windows | Neovim |
---|---|---|---|---|---|
C | {check-circle} Yes | {check-circle} Yes | {dotted-circle} No | {check-circle} Yes | {check-circle} Yes |
C++ | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes |
C# | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes |
CSS | {check-circle} Yes | {dotted-circle} No | {dotted-circle} No | {dotted-circle} No | {dotted-circle} No |
Go | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes |
Google SQL | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes |
HAML | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes |
HTML | {check-circle} Yes | {dotted-circle} No | {dotted-circle} No | {dotted-circle} No | {dotted-circle} No |
Java | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes |
JavaScript | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes |
Kotlin | {dotted-circle} No |
{check-circle} Yes (Requires third-party extension providing Kotlin support) |
{check-circle} Yes | {check-circle} Yes | {check-circle} Yes |
Markdown | {check-circle} Yes | {dotted-circle} No | {dotted-circle} No | {dotted-circle} No | {dotted-circle} No |
PHP | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes |
Python | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes |
Ruby | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes |
Rust | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes |
Scala | {dotted-circle} No |
{check-circle} Yes (Requires third-party extension providing Scala support) |
{check-circle} Yes | {check-circle} Yes | {check-circle} Yes |
Shell scripts (bash only) |
{check-circle} Yes | {dotted-circle} No | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes |
Svelte | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes |
Swift | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes |
TypeScript | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes |
Terraform | {dotted-circle} No |
{check-circle} Yes (Requires third-party extension providing Terraform support) |
{check-circle} Yes | {dotted-circle} No |
{check-circle} Yes (Requires third-party extension providing the terraform file type) |
Vue | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes | {check-circle} Yes |
NOTE: Some languages are not supported in all JetBrains IDEs, or might require additional plugin support. Refer to the JetBrains documentation for specifics on your IDE.
Locally, you can add more languages. For languages not listed in the table, Code Suggestions might not function as expected.
Manage languages for Code Suggestions
- Introduced in GitLab Workflow for VS Code 4.21.0
You can customize your coding experience in VS Code by enabling or disabling Code Suggestions for specific supported languages.
You can do this by editing your settings.json
file directly, or from the VS Code user interface:
- In VS Code, open the extension settings for GitLab Workflow:
- On the top bar, go to Code > Settings > Extensions.
- Search for GitLab Workflow in the list, and select Manage ({settings}).
- Select Extension Settings.
- In your User settings, find the section titled AI Assisted Code Suggestions: Enabled Supported Languages.
- You will see a list of all supported languages with checkboxes next to each language.
- To enable Code Suggestions for a language, ensure its checkbox is checked.
- To disable Code Suggestions for a language, uncheck its checkbox.
- Your changes are automatically saved and will take effect immediately.
When you disable Code Suggestions for a language, the Duo icon changes to show that suggestions are disabled for this language. On hover, it shows Code Suggestions are disabled for this language.
Add support for more languages
If your desired language doesn't have Code Suggestions available by default, you can add support for your language locally.
::Tabs
:::TabTitle Visual Studio Code
Prerequisites:
- You have installed and enabled the GitLab Workflow extension for VS Code.
- You have completed the VS Code extension setup instructions, and authorized the extension to access your GitLab account.
To do this:
- Find your desired language in the list of language identifiers. You need the Identifier for your languages in a later step.
- In VS Code, open the extension settings for GitLab Workflow:
- On the top bar, go to Code > Settings > Extensions.
- Search for GitLab Workflow in the list, and select Manage ({settings}).
- Select Extension Settings.
- In your User settings, find GitLab › Ai Assisted Code Suggestions: Additional Languages and select Add Item.
- In Item, add the identifier for each language you want to support. Identifiers should be
lowercase, like
html
orpowershell
. Don't add leading periods from file suffixes to each identifier. - Select OK.
:::TabTitle JetBrains IDEs
Prerequisites:
- You have installed and enabled the GitLab plugin for JetBrains IDEs.
- You have completed the Jetbrains extension setup instructions, and authorized the extension to access your GitLab account.
To do this:
- Find your desired language in the list of language identifiers. You need the Identifier for your languages in a later step.
- In your IDE, on the top bar, select your IDE name, then select Settings.
- On the left sidebar, select Tools > GitLab Duo.
- Under Code Suggestions Enabled Languages > Additional languages, add the identifier for each language
you want to support. Identifiers should be in lower case, like
html
. Separate multiple identifiers with commas, likehtml,powershell,latex
, and don't add leading periods to each identifier. - Select OK.
::EndTabs
Use open tabs as context
- Introduced in GitLab 17.2.
To enhance the accuracy and relevance of GitLab Duo Code Suggestions, enable the use of open tabs as context in your IDE settings. This feature uses the contents of files most recently opened or changed in your IDE to provide more tailored code suggestions, within certain truncation limits. This extra context gives you:
- More accurate and relevant code suggestions
- Better alignment with your project's standards and practices
- Improved context for new file creation
Open tabs as context supports these languages:
- Code Completion: All configured languages.
- Code Generation: Go, Java, JavaScript, Kotlin, Python, Ruby, Rust, TypeScript (
.ts
and.tsx
files), Vue, and YAML.
Enable open tabs as context
Prerequisites:
- Requires GitLab 17.1 or later.
- For GitLab self-managed instances, enable the
code_suggestions_context
and theadvanced_context_resolver
feature flags. - GitLab Duo Code Suggestions enabled for your project
- For Visual Studio Code, requires the GitLab Workflow extension, version 4.14.2 or later.
::Tabs
:::TabTitle Visual Studio Code
- Install the GitLab Workflow extension from the Visual Studio Marketplace.
- Configure the extension following the setup instructions.
- Enable the feature by toggling the
gitlab.duoCodeSuggestions.enabledSupportedLanguages
setting.
:::TabTitle JetBrains IDEs
For installation instructions for JetBrains IDEs, see the GitLab JetBrains Plugin documentation.
::EndTabs
When you're ready to start coding:
- Open relevant files, including configuration files, to provide better context.
- Close any files you don't want to be used as context.
View multiple code suggestions
- Introduced in GitLab 17.1.
For a code completion suggestion in VS Code, multiple suggestion options might be available. To view all available suggestions:
- Hover over the code completion suggestion.
- Scroll through the alternatives. Either:
- Use keyboard shortcuts:
- On a Mac, press Option + ] to view the next suggestion, and Option + [ to view the previous suggestions.
- On Windows, press Alt + ] to view the next suggestion, and Alt + [ to view the previous suggestions.
- On the dialog that's displayed, select the right or left arrow to see next or previous options.
- Use keyboard shortcuts:
- Press Tab to apply the suggestion you prefer.