symbols

package
v3.16.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package symbols extracts top-level symbols and import relationships from source files.

Extraction is driven entirely by pkg/discover/treesitter queries — no framework description is consulted, which is what makes this usable in discover's framework-agnostic path.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Supported

func Supported(l lang.Language) bool

Supported reports whether Extract can process the given language.

Types

type File

type File struct {
	Symbols []Symbol
	Imports []string
}

File holds the symbols and import paths extracted from one source file.

func Extract

func Extract(ctx context.Context, l lang.Language, src []byte) (File, error)

Extract parses src as the given language and returns its symbols and import paths.

type Kind

type Kind string

Kind categorizes a top-level symbol.

const (
	KindFunction Kind = "function"
	KindMethod   Kind = "method"
	KindType     Kind = "type"
	KindClass    Kind = "class"
	KindModule   Kind = "module"
)

type Symbol

type Symbol struct {
	Name string
	Kind Kind
}

Symbol is a declaration extracted from a source file.

Jump to

Keyboard shortcuts

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