Help us shape the future of Go! Take the 2026 Go Developer Survey

codeindex

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileID

func FileID(path string) string

func FormatNeighbors

func FormatNeighbors(idx *Index, id string, depth, limit int) string

func FormatSummary

func FormatSummary(idx *Index, maxSymbols int) string

func FormatSymbolContext

func FormatSymbolContext(idx *Index, id string, callers, callees bool) string

func FormatSymbolList

func FormatSymbolList(symbols []*Symbol) string

func ImportID

func ImportID(source string) string

func NameID

func NameID(name string) string

Types

type BuildOptions

type BuildOptions struct {
	Root      string
	Languages []string
	MaxFiles  int
}

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

func NewBuilder

func NewBuilder() *Builder

func (*Builder) Build

func (b *Builder) Build(ctx context.Context, opts BuildOptions) (*Index, error)

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

func DefaultCache

func DefaultCache() *Cache

func (*Cache) Build

func (c *Cache) Build(ctx context.Context, opts BuildOptions) (*Index, error)

func (*Cache) Clear

func (c *Cache) Clear()

func (*Cache) Get

func (c *Cache) Get(opts BuildOptions) (*Index, bool, error)

func (*Cache) Set

func (c *Cache) Set(opts BuildOptions, idx *Index) error

type Edge

type Edge struct {
	From     string
	To       string
	Relation RelationKind
	Label    string
}

type File

type File struct {
	ID       string
	Path     string
	Language string
	Package  string
	Symbols  []string
	Imports  []Import
}

type Graph

type Graph struct {
	Edges []Edge
	// contains filtered or unexported fields
}

func NewGraph

func NewGraph() *Graph

func (*Graph) Add

func (g *Graph) Add(from, to string, rel RelationKind, label string)

func (*Graph) In

func (g *Graph) In(id string) []Edge

func (*Graph) Out

func (g *Graph) Out(id string) []Edge

type Import

type Import struct {
	Source string
	Alias  string
}

type Index

type Index struct {
	Root    string
	Files   map[string]*File
	Symbols map[string]*Symbol
	Graph   *Graph
}

func BuildCached

func BuildCached(ctx context.Context, opts BuildOptions) (*Index, error)

func New

func New(root string) *Index

func (*Index) SortedFiles

func (idx *Index) SortedFiles() []*File

func (*Index) SortedSymbols

func (idx *Index) SortedSymbols() []*Symbol

type LanguageAdapter

type LanguageAdapter struct {
	ID              string
	Extensions      []string
	Language        *treesitter.Language
	DefinitionQuery string
	ImportQuery     string
	ReferenceQuery  string
}

func AdapterForPath

func AdapterForPath(path string, adapters []LanguageAdapter) (LanguageAdapter, bool)

func BuiltinLanguages

func BuiltinLanguages() []LanguageAdapter

type Reference

type Reference struct {
	Name      string
	Kind      RelationKind
	File      string
	StartByte uint
	EndByte   uint
}

type RelationKind

type RelationKind string
const (
	RelDefines       RelationKind = "defines"
	RelContains      RelationKind = "contains"
	RelImports       RelationKind = "imports"
	RelCalls         RelationKind = "calls"
	RelReferences    RelationKind = "references"
	RelCallsName     RelationKind = "calls_name"
	RelReferenceName RelationKind = "references_name"
)

type Symbol

type Symbol struct {
	ID        string
	Name      string
	Qualified string
	Kind      SymbolKind
	Language  string
	File      string
	StartByte uint
	EndByte   uint
	StartLine uint
	EndLine   uint
	Signature string
	ParentID  string
}

func FindSymbols

func FindSymbols(idx *Index, query, kind string, limit int) []*Symbol

type SymbolKind

type SymbolKind string
const (
	SymbolFunction  SymbolKind = "function"
	SymbolMethod    SymbolKind = "method"
	SymbolClass     SymbolKind = "class"
	SymbolStruct    SymbolKind = "struct"
	SymbolInterface SymbolKind = "interface"
	SymbolType      SymbolKind = "type"
	SymbolVariable  SymbolKind = "variable"
	SymbolConstant  SymbolKind = "constant"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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