doc/editor_extensions/visual_studio_code/projects.md
Use the GitLab for VS Code extension to work with GitLab projects:
With the extension, you can complete many of these tasks directly in VS Code. For others, the extension opens GitLab in your browser.
The GitLab for VS Code extension gives you access to use the GitLab Duo Agent Platform and GitLab Duo (non-agentic) as you work on your projects.
{{< details >}}
{{< /details >}}
To use GitLab Duo Agentic Chat, agents, and flows:
To use GitLab Duo Code Suggestions:
{{< details >}}
{{< /details >}}
To use GitLab Duo Non-Agentic Chat:
To use GitLab Duo Code Suggestions:
To create an issue in the current project:
GitLab opens the New issue page in your default browser.
To create a merge request in the current project, in the bottom status bar, select Create MR ({{< icon name="merge-request-open" >}}).
Alternatively, you can use the Command Palette:
GitLab opens the New merge request page in your default browser.
To view issues and merge requests for a specific project:
Use filtered search or advanced search to search your project's issues and merge requests directly from VS Code. With filtered search, you use predefined tokens to refine your search results. Advanced search provides faster, more efficient search across the entire GitLab instance.
Prerequisites:
To search your project:
GitLab opens the results in a browser tab.
Searches in large projects return better results when you add filters. The extension supports these tokens for filtering merge requests and issues:
| Token | Example | Description |
|---|---|---|
| assignee | assignee: sjones | Username of the assignee, without @. |
| author | author: zwei | Username of the author, without @. |
| label | label: frontend or label:frontend label: Discussion | A single label. Usable more than once, and can be used in the same query as labels. |
| labels | labels: frontend, Discussion, performance | Multiple labels in a comma-separated list. Can be used in the same query as label. |
| milestone | milestone: 18.1 | Milestone title without %. |
| scope | scope: created-by-me | Scope of the issue or merge request. Values: created-by-me (default), assigned-to-me or all. |
| title | title: discussions refactor | Words to match in the title or description. Do not add quotation marks around phrases. |
Token syntax and guidelines:
:) after it, like label:.
label :) is invalid and returns a parse error.label: frontend and label:frontend are valid.label and labels tokens multiple times and together. These queries return the same results:
labels: frontend discussion label: performancelabel: frontend label: discussion label: performancelabels: frontend discussion performance (the resulting, combined query)You can combine multiple tokens in a single search query. For example:
title: new merge request widget author: zwei assignee: sjones labels: frontend, performance milestone: 17.5
This search query looks for:
new merge request widgetzweisjonesfrontend and performance17.5To review, comment on, and approve merge requests in VS Code:
In the left sidebar, select GitLab ({{< icon name="tanuki" >}}).
Expand the issues and merge requests section, and then select your project.
Select the merge request you want to review.
Under the merge request's number and title, select Overview to read more about the merge request.
To review the proposed changes to a file, select the file from the list to show it in a VS Code tab. GitLab shows diff comments inline in the tab. In the list, deleted files are marked in red:
Use the diff to:
To use GitLab quick actions in issues and merge requests:
bug label to an issue, type /label bug.To compare your branch with your project's default branch, without creating a merge request:
The extension opens a new browser tab. It shows a diff between the most recent commit on your branch, and the most recent commit on your project's default branch.
To open a file from your current GitLab project in the GitLab UI, with specific lines highlighted:
Create a snippet to store and share bits of code and text with other users. Snippets can be a selection or an entire file.
To create a snippet in VS Code:
GitLab opens the new snippet's page in a new browser tab.
When you review a merge request, create a snippet patch when you want to suggest multi-file changes.
git diff command and creates a GitLab snippet in your project..patch.VS Code opens the snippet patch in a new browser tab. The snippet patch's description contains instructions on how to apply the patch.
To insert an existing single-file or multi-file snippet from a project you are a member of: