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 typesuper::Language- Language-specific parsers
§Dependents
Indexing::Scan::ScanFile- Symbol extraction during file scanIndexing::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§
- Symbol
Statistics - Symbol statistics
Functions§
- Create
Symbol Index - Create a symbol search index (name -> symbols)
- Deduplicate
Lists - Deduplicate multiple symbol lists
- Deduplicate
Symbols - Deduplicate symbols by name and line
- Extract
Symbols - Extract symbols from code for VSCode Outline View and Go to Symbol
- Filter
Symbols ByName - Filter symbols by name pattern
- Find
Symbol AtLine - Find symbol at specific line
- Find
Symbols InRange - Find symbols in line range
- Find
Symbols Matching - Find symbols matching multiple criteria
- GetSymbol
Statistics - Create symbol summary statistics
- GetSymbols
ByKind - Get symbols of a specific kind
- Group
Symbols ByKind - Group symbols by kind for organization
- Merge
Symbol Lists - Merge symbol lists from multiple files
- Sort
Symbols ByLine - Sort symbols by line number
- Validate
Symbol - Validate symbol information