Code Duplicate Detector
A powerful VS Code extension that finds duplicate code blocks across your project and suggests consolidation opportunities.
Features
- Smart Detection: Uses AST parsing for JavaScript/TypeScript and line-based analysis for other languages
- Configurable Similarity: Adjust similarity thresholds to find exact or near-duplicate code
- Multiple Views: Tree view for quick navigation and detailed webview report
- File Navigation: Click to jump directly to duplicate code locations
- Customizable Patterns: Configure which files to include/exclude from scanning
Usage
- Scan Workspace: Use
Ctrl+Shift+P and search for "Scan for Duplicate Code"
- View Results: Check the "Duplicate Code" panel in the Explorer sidebar
- Detailed Report: Click the preview icon to open a comprehensive HTML report
- Navigate: Click on any file in the results to jump to the duplicate code
Configuration
Access settings via File > Preferences > Settings and search for "Code Duplicate Detector":
minLines : Minimum number of lines for duplicate detection (default: 5)
similarity : Similarity threshold 0.1-1.0 (default: 0.8)
excludePatterns : File patterns to exclude from scanning
includePatterns : File patterns to include in scanning
Commands
Scan for Duplicate Code : Start scanning the workspace
Clear Results : Clear all duplicate detection results
Show Duplicate Report : Open detailed HTML report
Supported Languages
- JavaScript (.js)
- TypeScript (.ts)
- React (.jsx, .tsx)
- Python (.py)
- Java (.java)
- C/C++ (.c, .cpp)
- C# (.cs)
Installation
- Install from VS Code Marketplace
- Or install manually:
code --install-extension code-duplicate-detector-1.0.0.vsix
| |