Documentation
¶
Overview ¶
Package langutil provides shared language-aware helpers used across go-code packages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsExportedForDoc ¶ added in v1.22.0
IsExportedForDoc reports whether a symbol is considered exported for doc-coverage purposes, using language-appropriate rules. The logic mirrors isExportedSymbol in internal/compare/apisurf.go, extended with the IsPublic early-return for languages that carry an explicit visibility flag.
- IsPublic=true always wins — covers explicit "pub fn" (Rust), "def" with __all__ (Python), "public:" (C++), and any other language where the parser sets the flag.
- Go, Java, C#: uppercase-first-rune convention.
- JavaScript, TypeScript, Rust, Python, and all others: any non-underscore name is exported (matches the non-Go branch in apisurf.isExportedSymbol).
func IsTestFile ¶
IsTestFile returns true if the path looks like a test file based on suffix, prefix, infix, or containing directory.
func RelPath ¶
RelPath returns the relative path from root to abs. Falls back to the absolute path on error.
func TestStem ¶
TestStem extracts the logical stem from an infix-based test file path (e.g. "Button.test.ts" → "Button", true; "Modal.spec.svelte" → "Modal", true). It uses the first occurrence of ".test." or ".spec." in the file base-name. Returns ("", false) if the path does not contain a recognised infix or if the stem before the infix is empty (e.g. ".test.ts"). Detection is case-sensitive; lowercase the path first if case-insensitive matching is needed.
Types ¶
This section is empty.