starindex

package
v0.1.0-dev.20260828144100 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package starindex provides AST-based indexing of Starlark source files, extracting functions, loads, globals, and line statistics.

Index

Constants

View Source
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

type IndexedFunction struct {
	Name         string
	Line         int
	Params       int
	HasDocstring bool
	Docstring    string
}

IndexedFunction describes a function definition found in a Starlark file.

type IndexedGlobal

type IndexedGlobal struct {
	Name string
	Line int
}

IndexedGlobal describes a top-level assignment found in a Starlark file.

type IndexedLoad

type IndexedLoad struct {
	Module string
	Names  []string
	Line   int
}

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

func (p *Provider) IndexFiles(files []string, withDocstrings, withGlobals bool) (*Index, error)

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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