Unused Code Analyzer
A VS Code extension to detect unused imports, variables, and parameters in your codebase. Built with Go (WASM) for high performance.
Features
- Multi-language Support: TypeScript, JavaScript, Python, Go, Ruby, PHP, Astro, Svelte, Vue
- Auto Analyzer: Starts only after you open the "Unused Code" activity view, then analyzes on file changes/saves
- Tree View: Results displayed in Explorer sidebar
- Quick Navigation: Click to jump to unused code
- High Performance: Go backend compiled to WebAssembly with intelligent caching
Installation
- Open VS Code
- Go to Extensions (
Cmd+Shift+P → "Extensions: Open")
- Search for "Unused Code Analyzer"
- Click Install
Or install from VS Code Marketplace
Usage
Command Palette
Get Unused: Scan Workspace - Analyze entire workspace
Get Unused: Scan File - Analyze current file
Get Unused: Scan Folder - Analyze selected folder
Auto Analyzer
The extension automatically analyzes files when:
- The "Unused Code" activity view is opened at least once
- A relevant file is changed or saved after that
- Results are updated in real-time
Tree View
Open "Unused Code" view in Explorer sidebar. Results are shown with:
- File names and issue counts
- Issue types (Imports, Variables, Parameters)
- Click to jump to the issue
Settings
| Setting |
Default |
Description |
unused-code-analyzer.autoAnalyzer |
true |
Automatically analyze on save after the "Unused Code" activity view is opened |
unused-code-analyzer.autoAnalyzeDelay |
500 |
Delay in ms before auto-analyzing |
unused-code-analyzer.fileExtensions |
["ts", "tsx", "js", "jsx", "vue", "svelte", "astro", "py", "go", "rb", "php"] |
File extensions to scan |
unused-code-analyzer.excludeFolders |
["node_modules", ".next", "dist", "build", "out", ".git"] |
Folders to exclude |
Supported Languages
| Language |
Extensions |
Backend |
| TypeScript |
.ts, .tsx |
Native (ts-morph) |
| JavaScript |
.js, .jsx |
Native (ts-morph) |
| Python |
.py |
WASM (tokenizer-based) |
| Go |
.go |
WASM (tokenizer-based) |
| Ruby |
.rb |
WASM (tokenizer-based) |
| PHP |
.php |
WASM (tokenizer-based) |
| Astro |
.astro |
WASM (tokenizer-based) |
| Svelte |
.svelte |
WASM (tokenizer-based) |
| Vue |
.vue |
WASM (tokenizer-based) |
Architecture
- Backend: Go → WebAssembly
- Frontend: TypeScript + VS Code API
- UI: Tailwind CSS
- Caching: MD5 hash-based caching for fast incremental analysis
Development
# Install dependencies
npm install
# Build WASM (from backend directory)
cd backend && GOOS=js GOARCH=wasm go build -o ../out/main.wasm .
# Build extension
npm run build
License
MIT License - see LICENSE
☕ Enjoying Unused Code Analyzer? Buy me a coffee or leave a rating on the Marketplace!
| |