GitLab integrates Sourcegraph code navigation and code intelligence

Written by Christina Forney


Sourcegraph has the best find-definition, find-references, and intelligent code navigation capability on the planet - and they brought it to GitLab.

Sid Sijbrandij, GitLab CEO

Check out the below video where Quinn sat down with GitLab CEO Sid Sijbrandij to discuss the native GitLab integration, and why Sourcegraph's code intelligence means better code reviews and improved code quality for GitLab Enterprise customers and open source projects on GitLab.com.

View on Vimeo

Over 100,000 organizations use GitLab to manage their DevOps lifecycle. Today, GitLab announced its collaboration with Sourcegraph to provide a native integration for these organizations, making code navigation and code intelligence available to all GitLab users.

Developers need code navigation and code intelligence

Developers rely heavily on go-to-definition and find-references functionality. With development becoming more collaborative and complex, developers often spend more hours per day reading and reviewing code in the browser than writing code. There is now a gap between the experience of writing code locally and reviewing code online. GitLab realized that these code navigation and code intelligence features are essential in all parts of the developer workflow, especially in code hosts and at code review.

Sourcegraph provides these much-loved, much-used features at scale for all code, organization-wide: across repositories, for all popular programming languages, and on major code hosts. The world's most elite development teams rely on Sourcegraph, including Lyft, Uber, Yelp, Convoy, SoFi, and Quantcast.

Because we have many satisfied customers in common, a shared focus on developers, and some CEO-to-CEO discussion on Hacker News, GitLab chose Sourcegraph to integrate these essential code navigation and code intelligence features for the 100,000+ organizations who trust GitLab.

GitLab integration demo GIF

Built-in IDE-like features improve code reviews

Higher quality code reviews become possible when developers have more context about code they are reviewing. With this new integration, hover tooltips provide access to go-to-definition and find references in the browser on their code host. This means that developers can traverse the code they are reviewing, investigate the impact of code changes thoroughly by finding all affected references, and complete their code reviews faster, all without leaving the browser.

Higher-quality code reviews mean fewer bugs, and more time spent on building new features. Making open-source code easier to read and understand means faster identification of vulnerabilities, a better understanding of libraries, and less duplicated code.

Together, GitLab and Sourcegraph are creating a better world for enterprise and open source developers, consumers, and organizations.

When you can opt-in

To ensure a high quality integration, GitLab will begin testing this feature within the GitLab organization on GitLab.com as soon as MR #16556 is merged. On Nov 22nd, the integration will be included in the GitLab 12.5 release behind a feature flag. Once internal testing is complete, the feature flag will be lifted and all users can choose to opt-in to this feature on GitLab.com.

FAQ

What does this mean for the future of the browser extension?

The Sourcegraph browser extension will continue to provide code intelligence and code navigation for the major code hosts. The integration with GitLab simply means that developers unwilling to install browser extensions are able to enjoy valuable features seamlessly integrated with their GitLab workflow. Developers using the browser extension can additionally enjoy these features on GitHub, GitLab, Bitbucket server, Phabricator, and more, making their workflow comprehensive anywhere they view code.

Will Sourcegraph provide code intelligence for other code hosts?

Sourcegraph is pushing for code intelligence and navigation open standards and is working with other major code hosts to incorporate these features.

How does this work for public repositories?

Public GitLab repositories are available on Sourcegraph.com. Sourcegraph uses this context about the repository to provide code intelligence on GitLab (for users who opt-in).

How do I get this for my private code?

You will need to add your private repositories to a self-managed Sourcegraph instance.

  • For private GitLab instances, you can connect your self-managed Sourcegraph instance directly via the admin integration settings.
  • For private repositories on GitLab.com, you can connect the Sourcegraph browser extension to your Sourcegraph instance to show code intelligence on those repositories.

What languages are supported?

Sourcegraph provides code intelligence for the 25 most used programming languages:

  • Clojure
  • C++
  • C#
  • CUDA
  • Dart
  • Elixir
  • Erlang
  • Go
  • Haskell
  • Java
  • JavaScript/TypeScript
  • Kotlin
  • Lisp
  • Lua
  • OCaml
  • Perl
  • PHP
  • PowerShell
  • Python
  • R
  • Ruby
  • Rust
  • Scala
  • Shell
  • Swift