Blog Open Source Native code intelligence is coming to GitLab
Published on: November 12, 2019
4 min read

Native code intelligence is coming to GitLab

We're enhancing code review with Sourcegraph – no extra plugins required.

random_code.jpg

Almost a year ago, our CEO Sid Sijbrandij opened an issue proposing GitLab integrate with Sourcegraph to provide advanced code navigation and cross-referencing functionality for source code we host. We knew this feature would be a big improvement to the Developer UX in our product, particularly for efficient code review. We also knew Sourcegraph has an open-core product with one of the best-in-class code navigation capabilities. It only made sense to have a tighter integration between the two products.

How we built this

So, our generous friends at Sourcegraph got to work. A browser extension supporting GitLab was already available, but Sourcegraph collaborated with our engineering and product management teams and added the integration directly to the GitLab codebase – powered by GitLab.com and Sourcegraph.com. The integration gives users a fully browser-based developer platform, with no extra plugins required.

GitLab CEO and co-founder Sid Sijbrandij and Sourcegraph CEO and co-founder Quinn Slack explain the new integration. {: .note.text-center}

For now, get a sneak preview of how our integration with Sourcegraph works by watching a quick screencast tutorial.

The process of building the integration between Sourcegraph and GitLab is a great example of our transparency and collaboration values at work.

Collaboration in the open

Sourcegraph’s contribution to GitLab is significant for developer productivity. For example, their merge request (MR) adds native support for features like ‘go-to-definition’ and ‘find references’ within a hover tooltip. Users can engage the tooltip UI in code views, file views, merge requests, and code diffs. Developers can stay in context during code reviews when they need to investigate a function implementation by simply hovering over the name of the function to navigate efficiently. Within the tooltip, users can see the definition of the function, navigate to the definition, or show other references in the code where the function is being used. In addition to making code reviews higher quality and more efficient, developers will have an easier time investigating complex implementations when reading the source of their favorite library. With Sourcegraph, we’re enabling developers with a richer UX by gathering more information about the code they are reading.

See for yourself by reading the discussions on the MR and viewing changes made to the code. As always, we’re collaborating in the open and encourage the community to provide constructive feedback on our project. Drop a line in the blog comments to share your thoughts.

For a more detailed overview of the UX of functionality and features, check out this blog post by Christina Forney, product manager at Sourcegraph.

What does this mean for our users?

Gitlab’s integration with Sourcegraph will be available in our 12.5 release on November 22, 2019. We aim to provide code intelligence and code navigation functionality in this integration which was historically provided by the Sourcegraph’s browser extension. Now that we built this integration the browser extension is no longer needed to provide this functionality.

In the spirit of iteration our rollout strategy on GitLab.com is to first dogfood the functionality within our gitlab-org group, which is where GitLab stores source code for GitLab.com and GitLab Enterprise. Over time, we aim to roll out Sourcegraph capabilities across code views within projects to all public projects on GitLab.com. Users will still require the browser extension configured to a private instance of Sourcegraph for private projects on GitLab.com.

If you’re self-managing your GitLab EE deployment and would like to enable Sourcegraph code intelligence, you must have a private Sourcegraph instance running as an external service. This is required because Sourcegraph.com does not index any private code for privacy and security reasons. We will have formal documentation on how to get started with GitLab EE and Sourcegraph soon, but if you’re super curious, you can see our work in progress here within the MR branch.

What’s next?

Stay tuned for our 12.5 release announcement on November 22 and updates containing details around our integration with Sourcegraph. Give us a thumbs up if you like what we’re working on. If you’re new to Sourcegraph and/or GitLab, sign up here and install the browser extension to test out these features right away. Here is a link to a file in one of our public projects where you can test out these features.

Cover photo by Markus Spiske on Unsplash.

We want to hear from you

Enjoyed reading this blog post or have questions or feedback? Share your thoughts by creating a new topic in the GitLab community forum. Share your feedback

Ready to get started?

See what your team could do with a unified DevSecOps Platform.

Get free trial

Find out which plan works best for your team

Learn about pricing

Learn about what GitLab can do for your team

Talk to an expert