How-To's

Space Code Reviews in IntelliJ IDEA 2021.1

Read this post in other languages:
Français, 한국어, Türkçe, Deutsch, Português do Brasil, Русский, Español, 简体中文

Space makes it easy for you and your team to review code, and discuss changes. After making a change, you can request a review from one or more team members. When working on a feature branch, you can merge it back into the base branch, right from Space.

Code reviews and merge requests can be accessed from your browser, and using the Space desktop application. And from within the IDE!

The IDE is where developers feel at home, because it’s the place where they write code and create applications. The native integration between Space and IntelliJ-based IDEs comes with a lot of benefits, and lets us bring you a great user experience. Code reviews are just a first step! At JetBrains, we are committed to continuously improve the integration of Space and our IDEs.

In this post, let’s see how you can use any IntelliJ-based IDE to browse Space code reviews, assign, manage, view and submit comments, and accept changes.

JetBrains Space brings software developers together with chats, project management, issue tracking, Git hosting, CI/CD, and package repositories.

Create a free Space organization

Video

If you prefer video, our colleague Trisha Gee made a short overview of Space Code Reviews in IntelliJ IDEA:

Getting started

If you are using IntelliJ IDEA 2021.1, the Space plugin is now bundled. For other IDEs, you can install the Space plugin manually.

To get started, you’ll need to log in to Space in the IDE. You can do this from the settings, under Tools | Space. Enter the URL to your Space organization, press Log In, and your default browser will ask you to grant access from the IDE.

Log in to Space from the IDE

Once completed, you can use Get from VCS to list all projects and repositories in your Space organization. Search and select the Git repository you want to start with, and click Clone.

Clone Git repository from Space

The Space plugin also comes with a tool window where you can inspect jobs in Space Automation. The plugin adds code completion, syntax highlighting, for your .space.kts files.

But we’re here for code reviews, so let’s eh… review those!

Code Reviews tool window

In the sidebar, or using the Tools | Space | Code Reviews menu, you’ll find the Space Code Reviews tool window. It shows all code reviews for the current project, and lets you search and filter them.

Space Code Reviews tool window in IntelliJ IDEA

The quick filters let you browse:

  • Open or Closed code reviews
  • Reviews that contain your changes
  • Code reviews needing your attention
  • Changes that you need to review
  • Reviews assigned to you

Code review timeline

From the list of code reviews, you can navigate to its details. You’ll see basic details of the code review, such as who the authors and reviewers are. You can checkout the merge request’s branch if you want to have the full codebase at your fingertips.

Code review timeline

The code review timeline is also shown, where you can see all comments and changes that were made during the lifetime of this code review. You can add and reply to comments, and resolve them.

In Space, everything is a chat. Code review comments are no different: you can write additional comments on the code review, and browse and respond to threads as well. Without having to leave the IDE!

Respond to comments and threads in a code review

Folks using the browser or Space desktop app will see any comments you add, either directly in the code review if they have it open, or in Space chat.

Reviewing code in the IDE

After you open a code review in the IDE, you’ll see a list of files that were added, changed, or removed. You can open them, and see what was changed using the IDE’s diff viewer. From this diff, you can add comments to any line of code.

Add line comment to code review

Comments are saved as a draft, and sent at the end of your turn in the code review process. If needed, you can use Post now to send the comment immediately.

Accept changes, or wait for response

Once you’re done reviewing changes, you can finish your turn in the code review process. In the code review’s details, you can choose to:

  • Accept Changes, when everything looks fine from your point of view; or
  • Wait for Response, when you’ve reviewed the changes, but have open questions or concerns.

Accept Changes or Wait for Response

Any of these options will end your turn in the code review process, and post draft comments you added while looking through code.

Conclusion

There can be many reasons for a team to review code. Whether you want folks on your team to verify new code is clear, readable and doesn’t contain any serious flaws, or you want your code reviewed and approved before merging it to the main branch, you can now do this from within the IDE!

Give it a try! The Space plugin is now bundled in IntelliJ IDEA 2021.1, and you can install the Space plugin manually in our other IDEs.

We’ll be expanding functionality of the Space plugin in future releases. What would you like to see? Let us know in the comments!

P.S.: You can create a Space organization for free, and easily mirror an existing Git repository to get all the benefits of Space Code Reviews in IntelliJ IDEA.