Starting a Scan
There are multiple ways to initiate a workspace scan:Command Palette
- Open the Command Palette (
Ctrl+Shift+PorCmd+Shift+P) - Run “View Exports SVG: Start Scanning”
- The extension scans your entire workspace for SVG components
Context Menu
Right-click on:- A single file (scans that file)
- A folder (scans all files in that folder)
- Multiple selected files (scans all selected files)
How Scanning Works
The scanning process follows these steps:1. Workspace Discovery
The extension starts by finding files to scan:2. File Type Filtering
Only specific file types are scanned:- JavaScript:
.js,.jsx - TypeScript:
.ts,.tsx - Excludes:
.d.tsdeclaration files
The extension only scans JavaScript and TypeScript files. Other file formats are ignored to optimize performance.
3. Directory Exclusion
Certain directories are automatically excluded from scanning:node_modules/.git/dist/,build/,out/- Any directories matching your configured ignore patterns
4. SVG Component Extraction
For each file, the extension:- Parses the file content to find component declarations
- Identifies SVG-containing exports
- Extracts component metadata (name, declaration type, location)
- Validates SVG structure
- Detects animation elements
Caching System
The extension uses an intelligent caching mechanism to speed up subsequent scans:File Modification Cache
Tracks the last modified timestamp of each file:Cache Types
The extension maintains several caches:-
Declaration Cache (
declaration_cache.json)- Stores parsed component declarations
- Keyed by file path and modification time
-
Components Cache (
components_cache.json)- Stores extracted SVG component data
- Includes component metadata and properties
-
Favorites Cache (
favorites_cache.json)- Persists your favorite icons
- Synced across workspace sessions
-
Recent Icons Cache (
recent_cache.json)- Tracks recently used components
- Limited to configurable number of items
Cache Storage Location
Cache Storage Location
All cache files are stored in the extension’s global storage directory:The cache is automatically managed and doesn’t require manual intervention.
Scan Performance
Optimization Strategies
-
Incremental Scanning
- Only re-scans files that have been modified
- Uses file modification timestamps for comparison
-
Parallel Processing
- Scans multiple files concurrently
- Utilizes Promise.all for batch operations
-
Smart Filtering
- Excludes directories before traversing
- Filters by file extension early in the process
-
Cached Results
- Returns cached data for unchanged files
- Reduces parsing overhead significantly
Scan Results
After scanning completes:-
Dashboard/Home Update
- The main view updates with discovered components
- Components are grouped by file or component type
-
Scan Metadata
- Total files scanned is displayed
- Last scan date is recorded in settings
-
Error Handling
- Files with parsing errors are flagged
- Error messages are available in the Info panel
Result Display
Components are organized in the interface:Monitoring Scan Progress
The extension provides visual feedback during scanning:- Loading screen appears while scanning
- Progress indicator shows extraction status
- File count displays number of processed files
- Completion notification when scan finishes
You can continue working in VS Code while a scan is in progress. The webview panel will update automatically when scanning completes.
Manual Refresh
You can trigger a refresh of specific components:- Click the refresh button on a component group
- This re-scans only the files in that group
- Useful after making changes to icon files
Configuration Options
Ignored Directories
Customize which directories to exclude:Recent Icons Limit
Control how many recent icons to track:Technical Implementation
Technical Implementation
Key files involved in workspace scanning:
src/commands/scanning.ts- Scan command implementationsrc/utilities/files/scanning.ts- Core scanning logicsrc/utilities/files/allowedFilesInFolder.ts- File discoverysrc/utilities/files/processFiles.ts- File processingsrc/controllers/cache/- Caching system controllers
Troubleshooting
Scan Not Finding Icons
- Ensure files have
.js,.jsx,.ts, or.tsxextensions - Check that directories aren’t in the ignore list
- Verify SVG components are properly exported
Slow Scan Performance
- Add large directories to the ignore list
- Clear the cache and restart VS Code
- Reduce the number of files in your workspace
Cache Issues
- Clear all caches via extension settings
- Manually delete cache files from global storage
- Restart VS Code to reinitialize caches