tools

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EntityTypeModule    = "module"
	EntityTypeFile      = "file"
	EntityTypeSymbol    = "symbol"
	EntityTypeReference = "reference"

	// Symbol subtypes
	SymbolTypeFunction  = "func"
	SymbolTypeMethod    = "method"
	SymbolTypeStruct    = "struct"
	SymbolTypeInterface = "interface"
	SymbolTypeVariable  = "var"
	SymbolTypeConstant  = "const"
	SymbolTypeEnum      = "enum"
	SymbolTypeType      = "type"

	// Reference subtypes
	ReferenceTypeCall     = "call"
	ReferenceTypeUse      = "use"
	ReferenceTypeImpl     = "impl"
	ReferenceTypeOverride = "override"
)

EntityType constants for consistent usage

Variables

This section is empty.

Functions

func ExtractSymbolInfo

func ExtractSymbolInfo(symbolID string) (symbolType, name, file string, line, column int, err error)

ExtractSymbolInfo extracts symbol information from a symbol ID

func GetEntityType

func GetEntityType(entityID string) string

GetEntityType extracts the entity type from an ID

func IsValidEntityID

func IsValidEntityID(entityID string) bool

IsValidEntityID validates an entity ID format

func NormalizeSymbolType

func NormalizeSymbolType(symbolType string) string

NormalizeSymbolType converts a symbol type string to entity ID format. This provides a single source of truth for symbol type normalization. Returns empty string for unknown/invalid types.

This function ensures consistency between the types package EntityID methods and the tools package EntityIDGenerator.

func ParseEntityID

func ParseEntityID(entityID string) (entityType, identifier, location string, err error)

ParseEntityID extracts components from an entity ID

Types

type EntityIDGenerator

type EntityIDGenerator struct {
	// contains filtered or unexported fields
}

EntityIDGenerator creates stable, reproducible entity IDs for all code entities Format: {entity_type}:{identifier}:{location_info}

func NewEntityIDGenerator

func NewEntityIDGenerator(rootPath string) *EntityIDGenerator

NewEntityIDGenerator creates a new ID generator with the repository root path

func (*EntityIDGenerator) GetCallsiteID

func (g *EntityIDGenerator) GetCallsiteID(symbolName, file string, line, column int) string

GetCallsiteID creates a callsite ID: reference:call_<symbol_name>:<file>:<line>:<column>

func (*EntityIDGenerator) GetFileID

func (g *EntityIDGenerator) GetFileID(absPath string) string

GetFileID creates a file ID: file:<filename>:<relative_path>

func (*EntityIDGenerator) GetModuleID

func (g *EntityIDGenerator) GetModuleID(name, absPath string) string

GetModuleID creates a module ID: module:<name>:<relative_path>

func (*EntityIDGenerator) GetReferenceID

func (g *EntityIDGenerator) GetReferenceID(refType, symbolID, file string, line, column int) string

GetReferenceID creates a reference ID: reference:<type>_<symbol_id>:<file>:<line>:<column>

func (*EntityIDGenerator) GetSymbolID

func (g *EntityIDGenerator) GetSymbolID(symbolType, name, file string, line, column int) string

GetSymbolID creates a symbol ID based on symbol type: symbol:<type>_<name>:<file>:<line>:<column>

func (*EntityIDGenerator) GetUsageID

func (g *EntityIDGenerator) GetUsageID(symbolName, file string, line, column int) string

GetUsageID creates a usage ID: reference:use_<symbol_name>:<file>:<line>:<column>

Jump to

Keyboard shortcuts

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