codeindex

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Index

func Index(path string) (string, error)

Index parses a source file and returns its compact skeleton.

func SupportedExtensions

func SupportedExtensions() []string

SupportedExtensions returns file extensions with registered extractors.

Types

type Entry

type Entry struct {
	Section   Section
	Name      string
	Detail    string // one-line signature or type info
	StartLine int    // 1-indexed
	EndLine   int    // 1-indexed
	Fields    []string
}

Entry is one element of the file skeleton.

type Extractor

type Extractor interface {
	Extract(root *bonsai.Node, src []byte) []Entry
}

Extractor walks a tree-sitter AST and produces entries.

type Section

type Section string

Section labels an entry for the output skeleton.

const (
	SectionPackage  Section = "Package"
	SectionImport   Section = "Import"
	SectionType     Section = "Type"
	SectionFunc     Section = "Function"
	SectionMethod   Section = "Method"
	SectionConst    Section = "Constant"
	SectionVar      Section = "Variable"
	SectionClass    Section = "Class"
	SectionTrait    Section = "Trait" // interface in Java, trait in Rust
	SectionImpl     Section = "Impl"
	SectionModule   Section = "Module"
	SectionMacro    Section = "Macro"
	SectionHeading  Section = "Heading"  // markdown headings
	SectionResource Section = "Resource" // terraform/HCL blocks
)

Jump to

Keyboard shortcuts

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