Skip to content

Add SCIP support#343

Closed
jelmer wants to merge 5 commits into
jonashaag:masterfrom
jelmer:scip
Closed

Add SCIP support#343
jelmer wants to merge 5 commits into
jonashaag:masterfrom
jelmer:scip

Conversation

@jelmer

@jelmer jelmer commented May 27, 2026

Copy link
Copy Markdown
Contributor

I suppose this is more of a proof of concept. This replaces ctags usage with the SCIP file format, which is used by e.g. sourcegraph. It works fairly well for me with python code, and there's room for further feature enhancements.

jelmer and others added 5 commits May 27, 2026 15:03
New flag --scip {none,tags-and-branches,ALL} (and KLAUS_SCIP_POLICY env
var) controls when klaus should generate a SCIP index on demand for an
un-indexed revision.  When enabled, the first request kicks off a
background job that:

1. Adds a git worktree at a tempdir checked out to the requested commit.
2. Runs the first matching indexer (scip-python is the built-in).
3. Moves index.scip to <repo>/.scip/<sha>.scip.
4. Removes the worktree.

Subsequent requests for the same revision pick up the dump.  Concurrent
requests for the same (repo, sha) share a single in-process thread via
a lock.  Indexers are pluggable via klaus.scip_generate.INDEXERS.
- SCIP definitions get a stable id (sym-<hash>) so deep links jump to
  the actual occurrence rather than the line number.
- Non-definition occurrences now render as <a class=scip-reference>
  pointing at the definition's anchor, with data-sym, data-display,
  data-defhref / data-defloc, and data-refs attributes carrying the
  symbol's references inline.
- scip.js shows a hover popover with the display name, definition
  link, and reference list (up to 10, with overflow indicator).
- scip.css styles the popover and gives definitions a subtle
  underline + target highlight.
- Index now also exposes get_references and get_display_name,
  built from each Document's symbols list.
@jelmer jelmer closed this Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant