To install srclib and use it in your editor, follow these steps.
The src command-line tool is the interface to srclib.
go get -u -v sourcegraph.com/sourcegraph/srclib/cmd/src
Toolchains add support for languages (JavaScript, Ruby, Go, etc.).
Install the standard set of toolchains: src toolchain install-std
You can skip languages you don't want by adding, e.g., --skip ruby
.
To list installed toolchains, run src toolchain list
.
Install a srclib editor plugin, which provides doc lookups, find-usages, and type information with zero configuration needed (in most cases).
Interested in building a plugin for an editor srclib doesn't yet support? Let us know—we'd love to help!
Python | Ruby | JS | Go | Java | C++ | ... | |
---|---|---|---|---|---|---|---|
Emacs | |||||||
Vim | |||||||
Sublime | |||||||
Atom | |||||||
Eclipse | |||||||
... |
Right now, most people write code in editors that don't give them as much programming assistance as is possible. That's because creating an editor plugin and language analyzer for your favorite language and editor combo is a lot of work. And when you're done, your plugin only supports a single language and editor, and maybe only half the features you wanted.
Because there are no standard cross-language and cross-editor APIs and data formats, it is difficult to reuse your plugin for other languages or editors. So if there are M languages and N editors, we need to build M × N different plugins. That number gets large quickly, and so we suffer from poor developer tools.
srclib takes care of the code analysis that underlies key assistive features such as finding usages and jumping to definitions. It exposes a command-line API and outputs data in a well defined, language-independent format.
A plugin (or other tool) built on srclib just has to consume this data format to support all languages that srclib supports. srclib is designed to be modular and extensible. New languages can be added by implementing language toolchains that output the srclib format.
srclib handles:
Sublime | Vim | Emacs | Atom | Eclipse | ... | |
srclib | ||||||
Python | Ruby | JS | Go | Java | C++ | ... |
$ src api describe --file myfile.py --start-byte 123
)
Join the srclib mailing list to hear about support for new languages, editors, and analysis features.
srclib is 100% open source and built on other well-established open-source projects like Tern, YARD, and Jedi.
Check out the srclib docs for more info.
Hop on IRC, the srclib Google Group, or come meet us in person!