Developing the code host integrations
Code host integrations are how Sourcegraph delivers features directly into a code host's interface. These integrations allow developers to benefit from Sourcegraph without leaving their code host as they navigate repositories, source code files, commits, and diffs.
For a guide on usage of integrations, see the Integrations section.
How code host integrations are delivered
Code host integrations mainly operate on code views.
A code view is any instance of source code being displayed on any code host page. It can be an entire source file, a snippet of a file, or a diff view. There may be many code views on a single page, for example on a pull request page.
Code host integrations work by first identifying all code views on a given page, and then by adding interface elements (such as action buttons), and listening for hover events over specific code tokens in order to show hover pop-ups.
Relationship to the web UI
Sourcegraph code host integrations share some functionality and source code with the Sourcegraph web UI. Both support Sourcegraph extensions, which is how Sourcegraph provides code intelligence hovers, code decorations, action buttons, and other features.
The browser extensions, native integrations, and the web UI are collectively labeled as the web clients.
Contributing to code host integrations
The source code for code host integrations is located in the
browser directory of the Sourcegraph repository.
For build steps and details of the directory layout, see