Documentation
¶
Overview ¶
Package starindex provides AST-based indexing of Starlark source files, extracting functions, loads, globals, and line statistics.
Index ¶
Constants ¶
const (
IndexFiles op.ActionName = "starindex.index_files"
)
Action-name constants for the starindex provider's plan-mode actions.
Each constant is the short dotted action label its method dispatches under. Pass these to plan.Plan, op.ReceiverRegistry().BuildAction, RuntimeEnvironment.ActionByName, or WithActionNamed in place of a string literal so a typo is a compile error and rename / find-references work through the constant.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Index ¶
type Index struct {
Files []IndexedFile
Totals IndexTotals
}
Index holds the index results for all captured files.
type IndexTotals ¶
type IndexTotals struct {
FileCount, Functions, Loads, Globals int
LOC, SLOC, Comments, Blanks int
}
IndexTotals aggregates index counts across all files.
type IndexedFile ¶
type IndexedFile struct {
Path string
Functions []IndexedFunction
Loads []IndexedLoad
Globals []IndexedGlobal
LOC, SLOC, Comments, Blanks int
}
IndexedFile holds the index results for a single file.
type IndexedFunction ¶
IndexedFunction describes a function definition found in a Starlark file.
type IndexedGlobal ¶
IndexedGlobal describes a top-level assignment found in a Starlark file.
type IndexedLoad ¶
IndexedLoad describes a load statement found in a Starlark file.
type Provider ¶
type Provider struct {
op.ProviderBase
Root string
}
Provider performs AST-based indexing of Starlark source files.
func NewProvider ¶
func NewProvider(ctx *op.RuntimeEnvironment) *Provider
NewProvider creates a starindex provider bound to the given runtime environment, rooted at the environment's Root when present.
func (*Provider) IndexFiles ¶
IndexFiles parses all files and extracts functions, loads, and globals. If withDocstrings is true, function docstrings are extracted. If withGlobals is true, top-level assignments are captured.