🎯 Function Usage Map - Enhanced Edition
Advanced function analysis with dead code detection, smart filtering, complexity analysis, and quick refactoring actions for JavaScript/TypeScript projects.

🚀 Features
🔍 Intelligent Function Analysis
- Automatic Discovery: Finds all functions, arrow functions, classes, and React hooks
- Usage Tracking: Shows exactly where each function is used across your project
- Smart Filtering: Filter by function type, usage count, complexity, or documentation status
- Performance Optimized: Handles large projects with 1000+ files efficiently
🗑️ Dead Code Detection
- Zero-Usage Functions: Identifies functions that are never called
- Smart Analysis: Distinguishes between truly unused code and exported/special functions
- Quick Actions: One-click deletion of confirmed dead code
- Safety First: Prevents accidental removal of important functions
⚠️ Code Quality Analysis
- Complexity Scoring: Identifies overly complex functions that need refactoring
- Documentation Status: Highlights functions missing JSDoc comments
- Risk Assessment: Color-coded indicators (🟢 Safe, 🟡 Warning, 🔴 Danger)
- Overuse Detection: Finds functions used too frequently (potential coupling issues)
🛠️ Quick Actions & Refactoring
- Rename Functions: Smart rename with workspace-wide updates
- Add JSDoc: Auto-generate documentation templates
- Copy Function Names: Quick clipboard access
- Navigate to Usages: Jump to any function usage instantly
- Batch Operations: Process multiple functions at once
🎨 Rich Visual Interface
- Tree View Integration: Seamlessly integrates with VS Code Explorer
- Color-Coded Status: Instant visual feedback on function health
- Grouped Display: Functions organized by type for easy navigation
- Search & Filter: Powerful filtering options with live preview
- Progress Indicators: Real-time feedback during analysis
📸 Screenshots
Main Interface
🔧 Functions (45)
├─ ✅ calculateTotal (3 usages)
├─ ⚠️ complexValidator (1 usage) - High complexity
├─ 📝 helperFunction (5 usages) - No docs
└─ 🗑️ oldUtility (0 usages) - Dead code
⚡ Arrow Functions (28)
├─ ✅ handleClick (2 usages)
└─ 🗑️ unusedCallback (0 usages) - Dead code
🪝 React Hooks (12)
├─ ✅ useUserData (4 usages)
└─ ⚠️ useComplexState (1 usage) - High complexity
Dead Code Analysis Dashboard
📊 Dead Code Analysis Results
🗑️ Dead Code Functions (8 found):
• unusedHelper() - src/utils.ts:45
• oldValidator() - src/validators.ts:23
• debugFunction() - src/debug.ts:12
⚠️ Risky Functions (5 found):
• complexAlgorithm() - High complexity (score: 18)
• dataProcessor() - Missing documentation
💡 Recommendations:
- Remove 8 unused functions to clean up codebase
- Add documentation to 12 functions
- Refactor 3 overly complex functions
🚀 Getting Started
Installation
- Open VS Code
- Go to Extensions view (
Ctrl+Shift+X
)
- Search for "Function Usage Map"
- Click Install
Usage
- Open any JavaScript/TypeScript project
- Look for "Function Usage Map" in the Explorer panel
- Functions are automatically scanned and analyzed
- Use filters and quick actions as needed
First Time Setup
The extension works out of the box with sensible defaults. For large projects, consider adjusting these settings:
functionUsageMap.maxFilesToScan
: Increase for very large projects
functionUsageMap.enablePerformanceMode
: Keep enabled for faster processing
functionUsageMap.excludePatterns
: Add custom directories to skip
⚙️ Configuration
Settings
Setting |
Default |
Description |
maxFilesToScan |
1000 |
Maximum files to analyze (performance limit) |
maxUsagesPerFunction |
50 |
Maximum usages tracked per function |
complexityThreshold.warning |
8 |
Complexity score for warning level |
complexityThreshold.danger |
15 |
Complexity score for danger level |
enablePerformanceMode |
true |
Enable optimizations for large projects |
batchSize |
20 |
Files processed per batch |
excludePatterns |
["**/node_modules/**", "**/dist/**", ...] |
Directories to skip |
includeFileExtensions |
[".js", ".ts", ".jsx", ".tsx", ".mjs", ".cjs"] |
File types to analyze |
Example Configuration
{
"functionUsageMap.maxFilesToScan": 2000,
"functionUsageMap.complexityThreshold.warning": 10,
"functionUsageMap.complexityThreshold.danger": 20,
"functionUsageMap.excludePatterns": [
"**/node_modules/**",
"**/build/**",
"**/coverage/**",
"**/my-custom-dir/**"
]
}
🎯 Supported Languages
- ✅ JavaScript (
.js
, .mjs
, .cjs
)
- ✅ TypeScript (
.ts
)
- ✅ React/JSX (
.jsx
, .tsx
)
- ✅ Node.js modules
- ✅ ES6+ syntax
- ✅ React Hooks
Optimizations
- Batch Processing: Files processed in configurable batches
- Smart Exclusions: Skips common build/dependency directories
- Configurable Limits: Prevents analysis of excessively large codebases
- Concurrent Processing: Multiple files analyzed simultaneously
- Memory Efficient: Processes files without loading entire project into memory
Benchmarks
- Small Project (< 50 files): < 2 seconds
- Medium Project (100-500 files): 5-15 seconds
- Large Project (500-1000 files): 15-45 seconds
- Enterprise Project (1000+ files): Uses performance mode with limits
🛠️ Troubleshooting
Common Issues
Extension not showing functions?
- Ensure you're in a JavaScript/TypeScript project
- Check file extensions are included in settings
- Verify files aren't excluded by patterns
Analysis too slow?
- Enable performance mode (default: on)
- Reduce
maxFilesToScan
setting
- Add more exclude patterns
- Increase
batchSize
for faster processing
Functions showing as unused but they are used?
- Check for dynamic imports or runtime usage
- Verify function names match exactly (case sensitive)
- Look for usage in excluded directories
Debug Mode
Enable debug logging by opening VS Code Developer Console:
Help
→ Toggle Developer Tools
- Look for
Function Usage Map
logs
- Report issues with log details
🤝 Contributing
We welcome contributions! Please see our contributing guidelines:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
Development Setup
# Clone your forked repository
git clone <your-repo-url>
cd function-usage-map
npm install
npm run compile
📝 Changelog
See CHANGELOG.md for detailed release history.
📄 License
This project is licensed under the MIT License.
🙋♂️ Support
🏆 Why Choose Function Usage Map?
vs. Built-in VS Code Features
- More Comprehensive: Analyzes entire project, not just open files
- Dead Code Detection: Identifies unused functions automatically
- Complexity Analysis: Built-in code quality metrics
- Batch Operations: Process multiple functions efficiently
vs. Other Extensions
- Performance Focus: Optimized for large projects
- Rich Visual Interface: Color-coded, grouped, filterable display
- Smart Analysis: Distinguishes true dead code from exports
- Quick Actions: Integrated refactoring tools
- IDE Integration: Works seamlessly within VS Code
- Real-time Analysis: Updates as you code
- No Configuration: Works out of the box
- Visual Interface: No command-line complexity
Made with ❤️ for developers who care about code quality
Happy coding! 🚀