Documentation
¶
Overview ¶
Package scip turns a SCIP index into the semantic payload every external language producer shares.
SCIP is one format with many producers -- scip-java, scip-python, scip-ruby, scip-dotnet, scip-clang, and `rust-analyzer scip` -- so the conversion is written once here rather than once per language. What a language still owns is running its indexer and naming its package; what it does not own is the graph model, which is facts.NormalizeSemantic's.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Convert ¶
Convert turns one SCIP index into one semantic payload.
SCIP counts lines and characters from zero and every other producer of this graph counts them from one, which is what an editor shows: the positions are converted here, once. They used to be published as SCIP wrote them, so every Java and C# row pointed one line above its declaration.
The shape it produces is the one facts.NormalizeSemantic consumes: files, symbols with a full declaration range, references attributed to the symbol that encloses them, and an unresolved row for every target this repository does not declare.
Types ¶
type Options ¶
type Options struct {
// Language stamps every fact. It decides the provenance and the stable
// key namespace, so it is required.
Language facts.Language
// Repository is the registered repository name the payload belongs to.
Repository string
// Package names the unit the symbols belong to. Empty falls back to the
// repository name, which is what facts.NormalizeSemantic would do anyway.
Package string
PackageRoot string
ManifestPath string
// Analyzer and AnalyzerVersion identify the producer. They default to
// the index's own metadata, which is what a producer writes there.
Analyzer string
AnalyzerVersion string
// Authoritative marks the references as type-checked. It is a statement
// about the producer, not about SCIP: an index emitted by a syntax-only
// tool is still a valid SCIP index and its edges are still candidates.
Authoritative bool
// ReadFile returns the bytes of a repository-relative path, for
// converting the index's line/character positions into byte offsets. A
// nil reader leaves offsets at zero, which is honest but costs every
// consumer that ranks by position.
ReadFile func(relativePath string) ([]byte, error)
// IncludeFile decides whether a document enters the payload. A nil
// filter includes every document the index carries.
IncludeFile func(relativePath string) bool
// Generated reports whether a document is generated code.
Generated func(relativePath string) bool
// LocalPackages are the SCIP package identities that belong to this
// payload's repository. An occurrence of a symbol outside them is a
// reference to something this repository does not declare, and becomes
// an unresolved fact rather than an invented local symbol.
LocalPackages map[string]bool
}
Options is what the conversion cannot infer from the index itself.