Code Review Collaboration News

GitLab Support in JetBrains IDEs

Read this post in other languages:

GitLab is one of the most popular git-based platforms for software development and deployment. While all basic git operations have been possible with GitLab for a long time already, integration with GitLab is one of the most popular requests we receive from the JetBrains community. With this in mind, the JetBrains team joined forces with GitLab in 2023 to deliver precisely this type of integration.

We believe such integration might include various features affecting many different aspects of a developer’s work – from help with basic operations and navigation, to reviewing code, configuring CI pipelines, and building and deploying apps. Naturally, with such huge potential scope, definition of priorities is a must. Therefore, given that one of the most important tasks is reading, navigating, and writing code, we decided to start with proper review support within the IDE.

The first results of our collaboration landed in v2023.2, bringing you the ability to review without leaving your JetBrains IDE.

Now users can:

  • Configure GitLab account to be used for git operations and other interactions with GitLab.
  • Browse, filter, and search through the list of merge requests in the project.
  • Review merge requests in detail.
  • Leave comments on the code right from the IDE.
  • Request changes or merge them without using a browser.
  • Easily navigate and copy links to corresponding web pages.

Configuring your GitLab account

When the IDE detects that there is a git remote pointing to a GitLab server, the dedicated tool window on the left-hand side and corresponding action in the relevant menus appear. Using any git or GitLab-specific action will ask you to log in via your GitLab account using a token. If the server cannot be auto-detected, your GitLab account will need to be configured manually in Settings | Version control | GitLab

List of Merge Requests

By default, the tool window shows the list of all merge requests for the corresponding GitLab repository. You can use filters or plain text search to find the required merge request. There are predefined filter sets available, and the last configured set will be remembered.

Details of Merge Requests

Once the required merge request is found, open it up to see the details – name, branch information, changes, results of the checks. The timeline then automatically opens to add more to the overview of the request.

Clicking on the branch label will enable you to quickly check out the corresponding branch.

Changes and diffs with comment

The main part of a merge request are actual changes. A list of all changes in the merge request is shown right in the tool window. Double-click on a file to open a diff view, then just navigate between files by selecting them. Files that have comments will have corresponding markers in the tree.

To check individual commits independently, click on the number of commits and select the one you need in a popup.

If you have some question about the changes or the code around, add the comment in place by clicking the plus icon in the gutter.

Default action as a main control

Depending on the user role and the merge request state, there’s usually one action that is far more likely at the next step – e.g. requesting review, submitting comments, or merging. The integration determines it and shows a dedicated button to execute it. Other available actions are available under the More menu.

Merging Merge Requests

When you’ve performed the review and all other required checks are complete, it’s time to merge the request. In such a state, we offer merging as a main action for the request. The results of the checks are shown in place to let the user know whether or not the merge request can now be merged.

Other useful things

In addition to support for the review flow, we’ve added a couple of other helpful navigational actions. You can now copy the links to specific files and lines of codes on GitLab to easily share them with colleagues for discussion. You can also navigate directly to the web if needed.

Future plans

As we mentioned at the beginning, GitLab is much more than just a review tool. And in addition to enhancing reviews support event further, in future releases we plan to work on features to support CI pipeline configuration and troubleshooting. Stay tuned for more exciting developments to come.

Important note on supported versions

Updated on 27/06/2023.

Currently the integration supports GitLab Enterprise Edition versions 15.10 and above. In future updates we plan to extend the range of supported versions to include Community Edition and earlier versions.

image description