codectx

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

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

func Enclosing(lines []string, idx int, ext string) string

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.

Jump to

Keyboard shortcuts

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