Module ExtractSymbols

Module ExtractSymbols 

Source
Expand description

§ExtractSymbols

§File: Indexing/Process/ExtractSymbols.rs

§Role in Air Architecture

Provides symbol extraction functionality for the File Indexer service, extracting classes, functions, and other code constructs for VSCode Outline View and Go to Symbol features.

§Primary Responsibility

Extract code symbols from file content based on detected language, including functions, classes, structs, enums, traits, and more.

§Secondary Responsibilities

  • Language-specific symbol extraction
  • Line and column tracking for symbols
  • Symbol kind classification
  • Cross-file symbol reference support

§Dependencies

External Crates:

  • None (uses std library)

Internal Modules:

  • crate::Result - Error handling type
  • super::Language - Language-specific parsers

§Dependents

  • Indexing::Scan::ScanFile - Symbol extraction during file scan
  • Indexing::mod::FileIndexer - Symbol search operations

§VSCode Pattern Reference

Inspired by VSCode’s symbol extraction in src/vs/workbench/services/search/common/

§Security Considerations

  • Line-by-line parsing without eval
  • No code execution during extraction
  • Safe string handling

§Performance Considerations

  • efficient line-based parsing
  • Minimal allocations per file
  • Early termination for non-code files

§Error Handling Strategy

Symbol extraction returns empty vectors on parse errors rather than failures, allowing indexing to continue for other languages.

§Thread Safety

Symbol extraction functions are pure and safe to call from parallel indexing tasks.

Structs§

SymbolStatistics
Symbol statistics

Functions§

CreateSymbolIndex
Create a symbol search index (name -> symbols)
DeduplicateLists
Deduplicate multiple symbol lists
DeduplicateSymbols
Deduplicate symbols by name and line
ExtractSymbols
Extract symbols from code for VSCode Outline View and Go to Symbol
FilterSymbolsByName
Filter symbols by name pattern
FindSymbolAtLine
Find symbol at specific line
FindSymbolsInRange
Find symbols in line range
FindSymbolsMatching
Find symbols matching multiple criteria
GetSymbolStatistics
Create symbol summary statistics
GetSymbolsByKind
Get symbols of a specific kind
GroupSymbolsByKind
Group symbols by kind for organization
MergeSymbolLists
Merge symbol lists from multiple files
SortSymbolsByLine
Sort symbols by line number
ValidateSymbol
Validate symbol information