A goldmine of open source code is available to programmers, but choosing the right library and understanding how to use it can be tricky. Sourcegraph has created a search engine and code browser to help developers find better code and build software faster.
Sourcegraph is a code search engine and browsing tool that semantically indexes all the open source code available on the web. You can search for code by repository, package, or function and click on fully linked code to read the docs, jump to definitions, and instantly find usage examples. And you can do all of this in your web browser, without having to configure any editor plugin.
Sourcegraph was created by two Stanford grads, Quinn Slack and Beyang Liu, who, after spending hours hunting through poorly documented code, decided to build a tool to help them better read and understand code.
Try clicking on code snippets from Docker, a popular open source container library.
Are you a repository author?
If you're an author of an open source project or library, you should enable your repository on Sourcegraph. Enabling your repositories tells Sourcegraph to analyze and index your code so that contributors and users of your libraries can search and browse the code on Sourcegraph. These features can help your users save hours by letting them quickly find and understand pieces of code. A single good usage example can be worth a thousand words of documentation. Enabling repositories is free and always will be for open source.
Semantic search for projects, functions, or packages
Interactive code snippets
From Sourcegraph's UI, you can browse open source libraries quickly and efficiently. But sometimes, you want to share code outside that interface. For example, you might want to embed a snippet of code in a blog post or an answer to a forum question. Sourcegraph lets you embed clickable, interactive snippets of code with Sourceboxes. Here's an example:
The above code snippet is interactive. Try clicking on function calls and type references. Direct link to usage example..
Open source at its core
The core analysis library of Sourcegraph is open source and available as an easy-to-use library called srclib (pronounced "Source Lib"). srclib powers all the semantic analysis-enabled features you see on Sourcegraph.com, and also supports editor plugins that provide jump-to-definition and other semantically aware functionality.
Try it out and let us know what you think. You can reach us by email or on Twitter: @srcgraph. We made Sourcegraph to address pains we felt daily as programmers reading through code. We hope you find it useful, and we'd love to hear your thoughts and suggestions.