symbols

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package symbols extracts symbol definitions and references from source code using tree-sitter via gotreesitter (pure Go, no CGO required).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Extract

func Extract(source, language string) ([]Symbol, []Ref)

Extract parses source code in the given language and returns symbol definitions and references using tree-sitter tags queries. Parses the source only once: TagIncremental returns both tags and the parsed tree, which is then reused for type-info extraction (signature, return type, params) — avoiding a redundant second parse.

func SupportedLanguages

func SupportedLanguages() []string

SupportedLanguages returns the list of languages supported by Extract.

Types

type Ref

type Ref struct {
	RefName          string
	Kind             string
	Line             int
	Col              int
	ContainingSymIdx int // -1 if not inside a symbol
}

Ref represents a reference (call site) extracted from source code.

type Symbol

type Symbol struct {
	Name       string
	Kind       string
	Line       int
	Col        int
	EndLine    int
	EndCol     int
	ParentIdx  int // -1 if no parent
	Signature  string
	ReturnType string
	Params     string
	// contains filtered or unexported fields
}

Symbol represents a symbol definition extracted from source code.

Jump to

Keyboard shortcuts

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