scip

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package scip maps a SCIP index (produced by scip-typescript) into codegraph CALLS edges. SCIP gives type-checker-resolved reference occurrences; we turn each into a caller->callee edge by mapping symbols to our node qualified names and attributing each call site to the function/method that encloses it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallEdges

func CallEdges(index *scippb.Index, project, pathPrefix string, enc Enclosing) []graph.Edge

CallEdges turns SCIP reference occurrences into CALLS edges: callee = the type-checker-resolved referenced symbol, caller = the function/method enclosing the reference. Only references (not definitions) to invocable symbols count. Edges whose endpoints don't map are skipped; the store drops any that don't resolve to real nodes (honest precision).

func Read

func Read(path string) (*scippb.Index, error)

Read loads a SCIP index from a .scip protobuf file.

Types

type Enclosing

type Enclosing interface {
	At(relpath string, line int) (qn string, ok bool)
	Has(qn string) bool
}

Enclosing maps a call-site (repo-relative file + 1-based line) to the qualified name of the function/method that contains it — i.e. the caller — and reports whether a qualified name is a known call target.

type EnclosingNodes

type EnclosingNodes struct {
	// contains filtered or unexported fields
}

EnclosingNodes is an Enclosing built from graph nodes: for a (file, line) it returns the innermost Function/Method node whose line span contains it, and tracks all Function/Method QNs as the set of valid call targets.

func BuildEnclosing

func BuildEnclosing(nodes []graph.Node) *EnclosingNodes

BuildEnclosing indexes Function/Method nodes by file for caller lookup and by QN for callee validation.

func BuildEnclosingFromSpans added in v0.2.0

func BuildEnclosingFromSpans(spans []graph.FunctionSpan) *EnclosingNodes

BuildEnclosingFromSpans indexes lightweight function spans for caller lookup and callee validation without holding full graph.Node values in memory.

func (*EnclosingNodes) At

func (e *EnclosingNodes) At(relpath string, line int) (string, bool)

func (*EnclosingNodes) Has

func (e *EnclosingNodes) Has(qn string) bool

Has reports whether qn is a known function/method node (a valid call target).

type RunStats added in v0.2.0

type RunStats struct {
	PeakRSSBytes uint64
	NodeHeapMB   int
	Elapsed      time.Duration
}

RunStats reports resource use of one scip-typescript invocation. PeakRSSBytes is sampled from the child process on Linux/WSL (/proc); zero on platforms where RSS is not tracked (Windows native).

func RunAndRead

func RunAndRead(dir, outPath string) (*scippb.Index, RunStats, error)

RunAndRead runs scip-typescript in dir (which must hold a tsconfig.json and installed node_modules), writes the index to outPath, and reads it back. It is best-effort: callers treat an error as "no TS calls resolved this run".

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL