Install and set up the GitLab extension for Visual Studio

Download the extension from the Visual Studio Marketplace and install it.

The extension requires:

  • Visual Studio 2022, either AMD64 or Arm64.
  • The IntelliCode component for Visual Studio.
  • GitLab version 16.1 and later.
    • GitLab Duo Code Suggestions requires GitLab version 16.8 or later.
  • You are not using Visual Studio for Mac, as it is unsupported.

No new additional data is collected to enable this feature. Private non-public GitLab customer data is not used as training data. Learn more about Google Vertex AI Codey APIs Data Governance.

Connect to GitLab

After you download and install the extension, connect it to your GitLab account.

Create a personal access token

If you are on a self-managed GitLab instance, create a personal access token.

  1. On the left sidebar, select your avatar.
  2. Select Edit profile.
  3. On the left sidebar, select Access tokens.
  4. Select Add new token.
  5. Enter a name, description, and expiration date.
  6. Select the api and read_user scope.
  7. Select Create personal access token.

Authenticate with GitLab

Then authenticate with GitLab.

  1. In Visual Studio, on the top bar, go to Tools > Options > GitLab.
  2. In the Access Token field, paste in your token. The token is not displayed, nor is it accessible to others.
  3. In the GitLab URL text box, enter the URL of your GitLab instance. For GitLab.com, use https://gitlab.com.

Configure the extension

This extension provides these custom commands, which you can configure:

Command name Default keyboard shortcut Feature
GitLab.ToggleCodeSuggestions not applicable Enable or disable automated Code Suggestions.

You can access the extension’s custom commands with keyboard shortcuts, which you can customize:

  1. On the top bar, go to Tools > Options.
  2. Go to Environment > Keyboard. Commands exposed by this extension are prefixed with GitLab..
  3. Select a command, and assign it a keyboard shortcut.