Documentation
¶
Overview ¶
Package lang is the facade external consumers import. It centralizes every language-specific decision in Sift: file-path role classification for ranking, smart-filter rules, and (in cgo builds) tree-sitter signature extraction. Concrete types live in the leaf types package, global tables in registry, and the signature engine in the cgo-only signature subpackage; language drivers register themselves via init() and are pulled in by imports.go.
Index ¶
- func DeclMap(tags ...string) map[string]bool
- func HasImportScanner(path string) bool
- func ImportExtensions() []string
- func Imports(path, moduleRoot string, content []byte) []string
- func Register(l Language)
- func ResolveImports(path, moduleRoot string, content []byte, exists func(string) bool) []string
- func ShouldSkipSmart(path, filename string, content []byte) (bool, string)
- type Classification
- type ID
- type Language
- type Role
- type SignatureResolver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HasImportScanner ¶ added in v1.5.0
HasImportScanner reports whether the language for path extracts imports.
func ImportExtensions ¶ added in v1.5.0
func ImportExtensions() []string
ImportExtensions lists the sorted extensions of import-scanning languages.
func Imports ¶
Imports returns the import targets referenced by a file, resolved to repo-relative path prefixes. Paths whose language has no ImportScanner contribute no fan-in.
func ResolveImports ¶ added in v1.3.0
ResolveImports returns the import targets referenced by a file as confirmed, existing repo-relative file paths. Drivers implementing ImportResolver commit to real files; all other paths fall back to generic prefix expansion. exists reports whether a candidate path was collected.
Types ¶
type Classification ¶
type Classification = types.Classification
Classification is a soft selection signal for ranking and budgeting.
func Classify ¶
func Classify(path string) Classification
Classify applies shared conventions and then the language driver rules.
type ID ¶
ID uniquely identifies a supported language.
const ( Go ID = types.Go JavaScript ID = types.JavaScript TypeScript ID = types.TypeScript TSX ID = types.TSX Python ID = types.Python Rust ID = types.Rust Java ID = types.Java Kotlin ID = types.Kotlin CSharp ID = types.CSharp Cpp ID = types.Cpp Ruby ID = types.Ruby PHP ID = types.PHP Swift ID = types.Swift Dart ID = types.Dart Zig ID = types.Zig Other ID = types.Other )
Language IDs.
type Role ¶
Role describes the likely architecture purpose of a file.
const ( RoleUnknown Role = types.RoleUnknown RoleEntrypoint Role = types.RoleEntrypoint RoleAPI Role = types.RoleAPI RoleImpl Role = types.RoleImpl RoleTest Role = types.RoleTest RoleFixture Role = types.RoleFixture RoleMock Role = types.RoleMock RoleConfig Role = types.RoleConfig RoleSchema Role = types.RoleSchema RoleDocs Role = types.RoleDocs RoleGenerated Role = types.RoleGenerated RoleExample Role = types.RoleExample RoleVendor Role = types.RoleVendor )
File roles.
type SignatureResolver ¶
type SignatureResolver = types.SignatureResolver
SignatureResolver is an optional capability of a Language that maps a path to the signature registry ID for it.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package registry owns the global language lookup tables and the shared path-convention rules.
|
Package registry owns the global language lookup tables and the shared path-convention rules. |
|
Package signature owns the tree-sitter signature engine: per-language SignatureSpec registration and a pooled parser engine that reduces source to declaration signatures.
|
Package signature owns the tree-sitter signature engine: per-language SignatureSpec registration and a pooled parser engine that reduces source to declaration signatures. |
|
Package types defines the core language contracts shared by every driver and the registry.
|
Package types defines the core language contracts shared by every driver and the registry. |