Documentation
¶
Overview ¶
Package codectx extracts surrounding-scope context from source files without depending on a full AST. Tools (xref, grep, future inspectors) share these regex-based heuristics so the "nearest enclosing function/class/block" label stays consistent across the toolkit.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Enclosing ¶
Enclosing returns the nearest enclosing scope label preceding lines[idx]. `ext` is the lower-case file extension (".php", ".ts", ".twig", ".ini", ...). Returns "" when nothing recognisable is found or the extension isn't supported.
The result is a short human-readable label like "function deleteUser", "class UserService", "block content", or "[section_a]" — designed to fit next to a file:line citation without inflating LLM token cost.
Types ¶
This section is empty.