Back to Gitlabhq

GitLab for VS Code extension

doc/editor_extensions/visual_studio_code/_index.md

18.11.24.8 KB
Original Source

The GitLab for VS Code extension integrates GitLab Duo and other GitLab features directly into your IDE.

To get started, install and configure the extension. For added security, you can set up the extension in a Visual Studio Code Dev Container.

When configured, this extension brings the GitLab features you use every day directly into your VS Code environment:

  • Work with projects: Plan and track work with issues, review and discuss changes with merge requests, and share code snippets. Use GitLab Duo for AI-native planning and coding.
  • Monitor and test CI/CD pipelines: Test your pipeline configuration. View pipeline status and job outputs.
  • Secure your application: Review security findings and perform SAST scanning for your project.
  • Browse repositories: Access a GitLab repository in read-only mode without cloning it.

When you view a GitLab project in VS Code, the extension shows you information about your current branch:

  • The status of the branch's most recent CI/CD pipeline.
  • A link to the merge request for this branch.
  • If the merge request includes an issue closing pattern, a link to the issue.

GitLab extension panels

After you install and set up the extension, you can access the following features:

  • In the left sidebar, GitLab ({{< icon name="tanuki" >}}): Manage issues and merge requests, run CI/CD commands, view pipeline status, and perform security scanning. You can also extend your view with custom queries.
  • In the left sidebar, GitLab Duo Agent Platform ({{< icon name="duo-agentic-chat" >}}):
    • The chat tab: Interact with GitLab Duo Agentic Chat, or use the New chat ({{< icon name="duo-chat-new" >}}) dropdown list to select a foundational or custom agent to work with.
    • The flows tab: Use the Software Development Flow. Learn more about the difference between Chat and the flow.
  • In the status bar, Duo ({{< icon name="tanuki-ai" >}}): Check the feature status of GitLab Duo Code Suggestions and review suggestions in your file as you author code.
  • In the left sidebar, GitLab Duo Chat ({{< icon name="duo-chat" >}}): Interact with GitLab Duo Non-Agentic Chat.

If these features do not appear, see troubleshooting for guidance.

Customize keyboard shortcuts

You can assign different keyboard shortcuts for Accept Inline Suggestion, Accept Next Word Of Inline Suggestion, or Accept Next Line Of Inline Suggestion:

  1. In VS Code, run the Preferences: Open Keyboard Shortcuts command.
  2. Find the shortcut you want to edit, and select Change keybinding ({{< icon name="pencil" >}}).
  3. Assign your preferred shortcuts to Accept Inline Suggestion, Accept Next Word Of Inline Suggestion, or Accept Next Line Of Inline Suggestion.
  4. Press <kbd>Enter</kbd> to save your changes.

Update the extension

To update your extension to the latest version:

  1. In Visual Studio Code, go to Settings > Extensions.
  2. Search for GitLab published by GitLab (gitlab.com).
  3. From Extension: GitLab, select Update to {later version}.
  4. Optional. To enable automatic updates in the future, select Auto-Update.

Install the pre-release version

GitLab publishes pre-release builds of the extension to the VS Code Extension Marketplace.

To install the pre-release build:

  1. Open VS Code.
  2. Under Extensions > GitLab, select Switch to Pre-release Version.
  3. Select Restart Extensions.

Check GitLab Duo status

  1. In Visual Studio Code, on the bottom status bar, select the GitLab icon ({{< icon name="tanuki" >}}).
  2. A menu opens under the VS Code search box, and the GitLab for VS Code extension shows the status. Any errors are displayed next to Status:.

For GitLab Duo Non-Agentic Chat, you can also check the status of Chat.