DoraCodeLens VS Code Extension
An advanced VS Code extension that provides comprehensive code analysis and visualization capabilities for Python projects. DoraCodeLens creates interactive graph visualizations of project structure, dependencies, and code complexity while supporting framework-specific patterns for Django, Flask, and FastAPI. Enhanced with Git analytics, database schema analysis, and JSON utilities for complete project insights.

Features
🔍 Project Analysis
- Tech Stack Detection: Automatically identifies libraries and frameworks from requirements.txt, pyproject.toml, or Pipfile
- Framework Support: Specialized analysis for Django, Flask, and FastAPI projects
- Dependency Mapping: Visualizes module dependencies and import relationships
📊 Visual Representations
- Module Graph: Interactive visualization of project modules with complexity color-coding
- Call Hierarchy: Right-click any function to see its complete call graph
- Complexity Analysis: Visual indicators for code complexity using color coding (green/orange/red)
🚀 VS Code Integration
- Sidebar Panel: Browse project structure, dependencies, and modules
- CodeLens: Inline complexity scores above function definitions
- Context Menu: Right-click functions to show call hierarchy
- Webview Graphs: Interactive Cytoscape.js visualizations
🎨 Enhanced Visualizations
- Module Cards: Styled rectangular cards with folder-based organization
- Git Analytics: Author contributions, commit timelines, and module statistics
- Database Schema: Interactive schema graphs with table relationships
- Tabbed Interface: Organized views for Tech Stack, Graph, JSON, Git, and Database analysis
- JSON Utilities: Format, validate, and explore JSON data with tree view
- Current File Analysis: Quick insights for the file you're working on
- Export Capabilities: Share results in JSON, CSV, HTML, and image formats
- Git Integration: Comprehensive repository analysis and team insights
- Caching: Intelligent caching system for fast re-analysis
- Incremental Updates: Only re-analyzes changed files
- Large Project Support: Optimized for real-world codebases
Installation
Prerequisites
- VS Code 1.74.0 or higher
- Python 3.8 or higher
- Node.js 16.0 or higher (for development)
From VS Code Marketplace
- Open VS Code
- Go to Extensions (Ctrl+Shift+X)
- Search for "DoraCodeLens"
- Click Install
From Source
- Clone the repository:
git clone https://github.com/your-username/doracodelens-extension.git
cd doracodelens-extension
- Install dependencies:
npm install
cd analyzer
pip install -r requirements.txt
- Build and install:
npm run compile
code --install-extension doracodelens-*.vsix
Usage
Quick Start
- Open a Python project in VS Code
- Right-click on any Python file
- Select DoraCodeLens → Full Code Analysis → Tech Stack
- Explore your project's insights in the tabbed interface!
DoraCodeLens provides a comprehensive right-click context menu with organized options:
- Full Code Analysis: Complete project analysis with Tech Stack, Graph View, and JSON View
- Current File Analysis: Quick analysis of just the current file
- Git Analytics: Author statistics, module contributions, and commit timeline
- Database Schema: Visual schema graphs and raw SQL extraction
- JSON Utilities: JSON formatting and tree view capabilities
Interactive Features
- Module Cards: Enhanced graph visualization with styled rectangular cards
- Complexity Color Coding: Green (low), Orange (medium), Red (high complexity)
- Git Analytics Dashboard: Comprehensive contributor and commit analysis
- Database Schema Graphs: Visual representation of table relationships
- JSON Tree View: Expandable JSON structure exploration
Documentation
📚 Complete User Guide - Comprehensive guide to all features
📋 Quick Reference - Handy cheat sheet for daily use
🎯 Examples & Screenshots - Detailed usage examples
🔧 Developer Guide - Architecture and development setup
Supported Frameworks
Django
- URL pattern detection from urls.py files
- Model relationship mapping
- View function analysis
- Admin interface integration
Flask
- Route detection via @app.route decorators
- Blueprint pattern recognition
- Template rendering analysis
- SQLAlchemy model relationships
FastAPI
- Route detection via @app.get/post decorators
- Dependency injection pattern analysis
- Pydantic model relationships
- Automatic API documentation integration
Configuration
Extension Settings
Access settings via File → Preferences → Settings → Extensions → DoraCodeLens
doracodelens.enableCodeLens
: Enable/disable CodeLens complexity annotations
doracodelens.complexityThresholds
: Customize complexity color thresholds
doracodelens.cacheEnabled
: Enable/disable analysis result caching
doracodelens.maxProjectSize
: Maximum project size for analysis
Python Dependencies
The extension automatically manages Python dependencies, but you can manually install them:
cd analyzer
pip install -r requirements.txt
Example Projects
The examples/
directory contains sample projects demonstrating the extension's capabilities:
- django-todo: Django todo app with models, views, and URL patterns
- flask-todo: Flask todo app using Blueprints and SQLAlchemy
- fastapi-todo: FastAPI todo app with dependency injection
Each example includes setup instructions and demonstrates different framework patterns.
Troubleshooting
Common Issues
Extension not activating
- Ensure you have a Python project open
- Check that Python is installed and accessible
- Verify the workspace contains Python files
Analysis fails
- Check Python interpreter path in VS Code settings
- Ensure required Python packages are installed
- Review the Output panel for error messages
Performance issues
- Enable caching in extension settings
- Consider analyzing specific directories for large projects
- Adjust project size limits in settings
Webview not loading
- Disable other extensions that might conflict
- Check browser console in webview (Developer Tools)
- Restart VS Code and try again
Getting Help
Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
Development Setup
- Fork and clone the repository
- Install dependencies:
npm install
- Install Python dependencies:
cd analyzer && pip install -r requirements.txt
- Open in VS Code and press F5 to launch Extension Development Host
- Make changes and test in the development environment
Running Tests
# TypeScript tests
npm test
# Python tests
cd analyzer
python -m pytest
Architecture
DoraCodeLens uses a hybrid architecture:
- Python Analyzer: Static analysis engine using AST parsing
- TypeScript Extension: VS Code integration and UI
- Webview Visualization: Interactive graphs using Cytoscape.js
- Git Analytics Engine: Comprehensive Git repository analysis
- Database Schema Analyzer: Database schema analysis and visualization
For detailed architecture information, see docs/DEVELOPER.md.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
Changelog
See CHANGELOG.md for version history and updates.