Documentation
¶
Index ¶
Constants ¶
const DefaultParseTimeout = time.Second
DefaultParseTimeout caps how long the parser will spend on a single file. Past this point the file is treated as unsupported and falls through as raw content. Pathological inputs (large table-driven test files, generated parser tables) can otherwise dominate runtime.
const Separator = "⋮----"
Variables ¶
This section is empty.
Functions ¶
func Outline ¶
Outline reduces source to a structural skeleton: declarations, signatures and comments are kept, function bodies are dropped. Returns the outline and true if the file's language is supported, otherwise "", false.
func SetParseTimeout ¶
SetParseTimeout overrides the per-file parse timeout. Must be called before the first Outline or Pack call; later calls are ignored once a language pool has been created. A zero duration disables the timeout.
Types ¶
type File ¶
type File struct {
Path string
Content string
Language string
Outlined bool
Size int64
Skipped string // reason content was omitted, e.g. "binary", "too-large"
}
File is one packed file.
type Options ¶
type Options struct {
// MaxFileSize is the per-file byte limit. Files larger than this are
// listed in the tree but their content is omitted. Zero means 1MB.
MaxFileSize int64
// MaxFiles caps the number of files read. Zero means 10000.
MaxFiles int
// Compress applies tree-sitter outlining to supported source files.
// When false, full file contents are kept.
Compress bool
// Ignore adds gitignore-syntax patterns on top of .gitignore and the
// built-in defaults.
Ignore []string
// Concurrency is the number of files processed in parallel.
// Zero means runtime.NumCPU().
Concurrency int
}
Options configures Pack.
type Result ¶
Result is the output of Pack.
func Pack ¶
Pack walks root, reads text files that survive gitignore and default filtering, optionally outlines them, and returns the collected result.