Sourcegraph: A free code search tool for open source developers

No readers like this yet.
Grasshopper outside with graph overlay

Modified by Jen Wike Huger, CC BY-SA

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

Sourcegraph indexes code at a semantic level, which means it parses and understands code the same way a compiler does. This is necessary to support features such as semantic search and finding usage examples. Sourcegraph currently supports Go, Java, and Python, with JavaScript, Ruby, and Haskell in beta.

Try searching for popular projects like Docker, the AWS Java SDK, Kubernetes, redis-py, or your own project.

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.

Tags
User profile image.
Charles Vickery is the community manager and co-creator of @srcgraph. Outside of Sourcegraph, Charles is a DJ, an opera singer, and a cross-country bicyclist.Follow him on Twitter: @charles_vickery.

4 Comments

Je ne connais pas le produit je test et je vous dit ce que j'en pense

Great article about a great tool. Searching the internet for a piece of code becomes much more easier with this tool.

great tool

Very good tool. I think it will very useful for me and all the developer. I hope for the c# support soon.

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.