Skip to content

Language Support

Lisa edited this page Dec 20, 2025 · 6 revisions

Language Support

CKB works with any language, but the depth of analysis varies based on available tooling.


How CKB Analyzes Code

CKB combines multiple sources of code intelligence:

Source What it provides Speed
SCIP Index Pre-computed symbol map with all definitions, references, and relationships Instant
LSP Real-time queries to a language server Fast (may timeout on large queries)
Git Blame, history, churn, ownership Fast
Heuristics File patterns, naming conventions, import scanning Instant

The SCIP index is the key differentiator. Languages with a SCIP indexer get precise, complete analysis. Languages without one fall back to LSP or heuristics.


Support Tiers

Enhanced Tier (SCIP available)

Full code intelligence with precise, pre-computed data.

Features:

  • Precise symbol search (no false positives)
  • Complete reference finding
  • Accurate call graphs (callers and callees)
  • Impact analysis with confidence scores
  • Dead code detection
  • Symbol justification (keep/investigate/remove)

Languages:

Language Indexer Install
Go scip-go go install github.com/sourcegraph/scip-go/cmd/scip-go@latest
TypeScript/JavaScript scip-typescript npm install -g @sourcegraph/scip-typescript
Python scip-python pip install scip-python
Java scip-java scip-java docs
Kotlin scip-kotlin scip-kotlin docs
Rust rust-analyzer rust-analyzer docs
C/C++ scip-clang scip-clang releases
Dart scip_dart dart pub global activate scip_dart
Ruby scip-ruby scip-ruby docs
C# scip-dotnet scip-dotnet docs
PHP scip-php scip-php docs

Run ckb index to auto-detect your language and run the appropriate indexer.


Basic Tier (LSP only)

Real-time analysis via language server. Good for navigation, but slower and less complete for large queries.

Features:

  • Symbol search (may have gaps)
  • Go to definition
  • Find references (within open scope)
  • Limited call graph support

Missing compared to Enhanced:

  • Complete cross-file reference finding
  • Accurate call graphs
  • Impact analysis confidence
  • Dead code detection

When you're in this tier:

  • Language has an LSP server but no SCIP indexer
  • SCIP indexer exists but isn't installed
  • SCIP index wasn't generated yet

How to check: Run ckb status - if you see "SCIP: not available" but "LSP: available", you're in Basic tier.


Minimal Tier (Heuristics only)

File-based analysis using patterns and naming conventions. Works for any language but limited depth.

Features:

  • Module detection (finds package boundaries)
  • Import scanning (understands dependencies)
  • File role classification (test, config, entrypoint)
  • Architecture overview (module graph)
  • Git-based features (ownership, hotspots, blame)

Missing compared to Basic:

  • Symbol-level navigation
  • Reference finding
  • Call graphs

When you're in this tier:

  • No SCIP indexer available
  • No LSP server configured
  • Unsupported or niche language

Feature Matrix

Feature Enhanced Basic Minimal
Symbol search Precise Partial -
Go to definition Yes Yes -
Find all references Complete Partial -
Call graph Yes Limited -
Impact analysis High confidence Low confidence -
Dead code detection Yes - -
Module detection Yes Yes Yes
Architecture overview Yes Yes Yes
Ownership (CODEOWNERS) Yes Yes Yes
Ownership (git blame) Yes Yes Yes
Hotspot detection Yes Yes Yes
File role classification Yes Yes Yes

Upgrading Your Tier

From Minimal to Basic

Configure an LSP server in .ckb/config.json:

{
  "lsp": {
    "servers": {
      "your-language": {
        "command": "your-language-server",
        "args": ["--stdio"]
      }
    }
  }
}

From Basic to Enhanced

  1. Install the SCIP indexer for your language (see table above)
  2. Run ckb index or the indexer directly
  3. Verify with ckb status

Special Cases

C/C++

C++ requires a compilation database (compile_commands.json) because the indexer needs to know compiler flags, include paths, and preprocessor defines.

Generate it with:

# CMake
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -B build .

# Meson
meson setup build

# Make (via Bear)
bear -- make

Then run: scip-clang --compdb-path=build/compile_commands.json

Multi-language Projects

CKB supports one SCIP index per project. For polyglot repos:

  1. Index the primary language
  2. Other languages fall back to LSP or heuristics
  3. Git-based features (ownership, hotspots) work for all files

Future versions may support merging multiple SCIP indexes.

Generated Code

Generated files (protobuf, GraphQL, etc.) should be generated before indexing:

go generate ./...
ckb index

Otherwise generated symbols won't appear in the index.


Checking Your Setup

# See what's available
ckb status

# Diagnose issues
ckb doctor

Example output for Enhanced tier:

Backends:
  SCIP: available (47,832 symbols indexed)
  LSP: available (go language server)
  Git: available (1,247 commits)

Example output for Basic tier:

Backends:
  SCIP: not available (run 'ckb index' to generate)
  LSP: available (typescript-language-server)
  Git: available (892 commits)

Adding Support for New Languages

If your language has a SCIP indexer that CKB doesn't know about:

  1. Run the indexer manually to generate index.scip
  2. CKB will detect and use it automatically
  3. Consider opening an issue to add it to ckb index

If no SCIP indexer exists for your language:


Summary

Your situation Tier What to do
Indexer installed, index generated Enhanced You're all set
Indexer available, not installed Basic Run ckb index
No indexer, but LSP available Basic Configure LSP in config
No indexer, no LSP Minimal Git features still work

Most popular languages have SCIP indexers. Run ckb index and you'll likely get Enhanced tier automatically.

Clone this wiki locally