Documentation
¶
Overview ¶
Package scip provides utilities for reading and processing SCIP code intelligence indexes. Import alias: gocodescip "github.com/anatolykoptev/go-code/internal/scip"
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CacheKey ¶
CacheKey computes a 16-hex-char key from the mtimes of source files in dir. Hidden files and the .git directory are skipped for speed.
func ConvertToEdges ¶
func ConvertToEdges(idx *Index) []goanalysis.TypedEdge
ConvertToEdges converts a SCIP Index into a slice of TypedEdge call edges. It performs two passes:
- Build a definition map (symbol → defInfo) and per-file function ranges.
- For each non-definition reference, find the enclosing function and emit an edge.
func IndexerAvailable ¶
IndexerAvailable reports whether the indexer binary for the given binary name is present in PATH. Callers typically pass cfg.Name from DetectIndexer.
func RunIndexer ¶
RunIndexer executes the SCIP indexer described by cfg inside dir. It returns the path to the generated index.scip file. stdout and stderr from the subprocess are discarded. Returns an error if the binary is not found or the process exits non-zero.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache stores SCIP index files keyed by a content hash.
type Index ¶
Index holds the parsed contents of a SCIP index file.
func ReadIndex ¶
ReadIndex opens and streams-parses a SCIP index file at the given path. An empty file returns an empty Index without error. A missing file returns a non-nil error.
func (*Index) DocumentCount ¶
DocumentCount returns the number of documents in the index.
type IndexResult ¶
type IndexResult struct {
IndexPath string // path to the index.scip file
Cleanup func() // removes temp dir if one was created; nil if dir was writable
}
IndexResult holds the path to the generated index and an optional cleanup function.
func RunIndexerSafe ¶
func RunIndexerSafe(ctx context.Context, cfg IndexerConfig, dir string) (*IndexResult, error)
RunIndexerSafe runs the indexer in dir, copying to a temp dir first if dir is read-only. Caller MUST call result.Cleanup() when done with the index.
type IndexerConfig ¶
type IndexerConfig struct {
Name string // binary name (e.g. "scip-typescript")
Args []string // default args to pass after the binary name
}
IndexerConfig describes how to invoke a SCIP indexer for a language.
func DetectIndexer ¶
func DetectIndexer(lang string) (IndexerConfig, bool)
DetectIndexer returns the IndexerConfig for the given language. Returns (IndexerConfig{}, false) for unsupported languages.