Cross-repository precise code navigation for C and C++

Varun Gandhi

We're excited to announce cross-repository precise code navigation support for C and C++ in scip-clang. We initially released scip-clang last month, and this feature addition brings scip-clang up to parity with our other SCIP indexers, providing best-in-class online code navigation for C++ codebases spread out across multiple repositories.

Here is a demo showcasing how it works:

Cross-repository code navigation works for all features supported by scip-clang, such as types, methods, macros, forward declarations etc.

The primary change required to benefit from cross-repository code navigation is supplying an extra package map file in JSON format, which describes:

  • The root directories for third-party packages, so that scip-clang can correctly translate on-disk paths to paths in Sourcegraph.
  • Package name and version information, so that scip-clang can correctly identify which symbol belongs to which package.

The package map JSON format offers a flexible way of providing package information that can be targeted by different build systems and package managers. We decided to go with this approach as the large variety in C and C++ build tooling makes it difficult for scip-clang to automatically infer package information from file system layout.

More details about the package map format, including examples, can be found in the scip-clang documentation.

Please try out the new cross-repository code navigation and let us know what you think!

Get Cody, the AI coding assistant

Cody makes it easy to write, fix, and maintain code.