Sourcegraph 3.0 is now shipping! This release comes with HUGE improvements so you can search and navigate all your organization's code more quickly, with code intelligence (go-to-definition and find-references) for all languages.
What is Sourcegraph? Sourcegraph is an open source, self-hosted, cross-repository code search and navigation tool, with an efficient web interface and "feels-like-native" integration into your code host. Install or upgrade Sourcegraph.
Highlights of this release:
Plus, there are several new and improved Sourcegraph extensions:
Also, in case you missed it, Sourcegraph is now open source (Apache-licensed).
Want to hear about new features and releases as soon as they're available? Follow @srcgraph.
Two of the most common questions developers have while reading code are:
You can now answer these questions easily across all of your organization's code, with Sourcegraph's improved code intelligence (go-to-definition and find-references) for N languages.
It works immediately for all code with zero configuration because it uses heuristics to provide fuzzy results by default. This is surprisingly helpful and fast, and it finds results in your other repositories, too.
As long as you're aware of the limitations of the default (non-language server) mode, you'll like it lot. For example, in this mode, if multiple functions in your code are named
open, the reference results for
open will include false positives. (If it bothers you, run the extension's associated language server for precise results, or disable the language extension.)
For the most popular languages, the new language extensions are enabled by default on Sourcegraph.com and self-hosted instances on Sourcegraph 3.0.
We want anyone to be able to start using Sourcegraph for code search without reading a manual. That's why we made Sourcegraph search super fast and added one-click query suggestions (computed locally using heuristics) to refine your query.
But when you're searching more than a couple times daily, learning Sourcegraph's search keywords (such as
repo:) will make you more productive. Click the new ? icon next to any search button to see a quick reference. See "Search query syntax" for more info.
Try it out (click the ? next to the search button):
showProgress(...)): extensions can show a window-level loading indicator for long-running tasks.
TextDocumentDecoration#dark): when decorating code files with text and links, extensions can specify different colors to use depending on the prevailing UI theme (dark or light) to ensure sufficient contrast.
CodeEditor#selections): extensions can determine the currently selected range (or ranges, for multiple selections).
onDidChangeRoots): extensions can determine the currently active repository and subscribe to changes (i.e, when the user navigates to a different repository or revision).
sourcegraph.app.createPanelView): extensions can define custom tabs in the panel, in addition to the standard definition and references tabs, such as for showing implementations, type definitions, and other information. The content can be a list of locations or arbitrary Markdown.
sourcegraph.search.registerQueryTransformer): extensions can define query transformers to implement custom search keywords, such as transforming
panel/toolbarmenu contribution point: extensions can add actions that are shown in the panel (above references and definitions). This is useful for actions that affect the result set of references or definitions, such as changing which types of references are shown (e.g., function calls only vs. all uses).
searchFilterscontribution: extensions can add static search filters to suggest additions to a user's query. (This is the first step toward extensions being able to provide search results, which will allow Sourcegraph to search more things, such as GitHub issues, logs, and configuration data.)
We shipped other improvements to the extension development process:
npm init sourcegraph-extensionextension generator: easily create the skeleton of a new Sourcegraph extension.
"wip": trueis marked as a work-in-progress so that users don't inadvertently install it.
The Sourcegraph extensions authoring documentation also got some new tutorials:
The new management console is a separate, failsafe web interface for changing critical site configuration. This improves the experience for admins:
.ymlfiles and redeploy.)
The management console runs on a separate port (2633 by default) and is protected by strong, randomly generated password that is visible only in the site admin area:
Use this password to authenticate to
https://sourcegraph.example.com:2633 (using your actual hostname instead). Be sure to use
https (and note that it uses a self-signed certificate that you will need to trust on first use). Once you're in, you can edit critical configuration (with validation and autocompletion):
Now you have more options when you need to scale to a cluster of Sourcegraph. (Deploying Sourcegraph with Docker to a single container is the most popular deployment method, and we still recommend all instances start with it.)
The pure-Docker cluster deployment reference for Sourcegraph contains multiple Dockerfiles that use only the most basic orchestration primitives to connect to each other. You can adapt these files to deploy to your preferred cluster management/orchestration system, such as Netflix's Titus or Mesosphere. If you don't have a preferred system, we recommend deploying to Kubernetes (which was previously the only cluster deployment option).
See "Installing Sourcegraph on a cluster" for more information.
You can configure Sourcegraph to allow users to sign in via GitHub or GitHub Enterprise. (Many other user authentication providers are supported, such as SAML, OpenID Connect, GitLab, builtin username-password, and HTTP auth proxies).
Sourcegraph can also enforce GitHub or GitHub Enterprise repository access permissions, so that users can only search and view repositories on Sourcegraph if they are permitted to do so on GitHub. This feature makes Sourcegraph delegate authorization checks for repository access to GitHub, so your GitHub repository permissions are the source of truth.
See "GitHub integration with Sourcegraph" for more information.
All external HTTP serving and configuration (TLS, listen ports, Let's Encrypt, etc.) is now handled by Nginx, a popular, open source HTTP server. See "Sourcegraph nginx HTTP server settings" for information on how to configure the external web server for Sourcegraph.
Previously, Sourcegraph implemented these HTTP features internally. We found that most admins preferred to wrap Sourcegraph with Nginx (sometimes using ingress-nginx) anyway, so we decided to make that the preferred and only way. Now that Sourcegraph relies on Nginx, you have the full power and configurability of Nginx at your disposal.
We trimmed the initial bundle size by ~50% for the Sourcegraph web app. This speeds up page loads on Sourcegraph.com and your own Sourcegraph instance. Thanks, Webpack! (As a JS Foundation member, Sourcegraph is proud to support Webpack.)
The new Datadog metrics extension adds View metric links at the end of lines of code that contain calls to record Datadog/statsd metrics. This makes it easy to see how code is behaving in production and in real time when you're reading and reviewing code.
Because this is a Sourcegraph extension, it works on Sourcegraph and on your code host (such as on GitHub code files and PRs).
For example, if your code records the time it takes to respond to queries, this extension makes it easy to jump to the query response time statistics from your code:
The main docs.sourcegraph.com page was reorganized to make the most common documentation easier to get to. We've also added a lot more documentation pages throughout.
This release includes more solid foundations for several Sourcegraph features:
Thank you to the many people who contributed to make Sourcegraph better since our last release!
Ready to install? Install Sourcegraph 3.0.1
Upgrading from 2.x or 3.0.0? See the migration guide
From the entire Sourcegraph team (@srcgraph), happy coding!