An LSIF indexer is a command line tool that analyzes your project's source code and generates a file in LSIF format containing all the definitions, references, and hover documentation in your project. That LSIF file is later uploaded to Sourcegraph to provide code intelligence.
src
) for uploading LSIF data on your CI machines.Make sure the current working directory is somewhere inside your repository, then run:
$ src \ -endpoint=https://sourcegraph.example.com \ lsif upload \ -github-token=abc... (only needed when uploading to Sourcegraph.com) \ -file=<LSIF file (e.g. ./cmd/dump.lsif)>
If you're uploading to Sourcegraph.com, you must authenticate your upload by passing a GitHub access token with
public_repo
scope as-github-token=abc...
. You can create one at https://github.com/settings/tokens
If successful, you'll see the following message:
Upload successful, queued for processing.
If an error occurred, you'll see it in the response.
Start with a periodic job (e.g. daily) in CI that generates and uploads LSIF data on the default branch for your repository.
If you're noticing a lot of stale code intel between LSIF uploads or your CI doesn't support periodic jobs, you can set up a CI job that runs on every commit (including branches). The downsides to this are: more load on CI, more load on your Sourcegraph instance, and more rapid decrease in free disk space on your Sourcegraph instance.