Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Dead Code Highlighter — Find Unused Functions, Variables & ImportsNew to Visual Studio Code? Get it now.
Dead Code Highlighter — Find Unused Functions, Variables & Imports

Dead Code Highlighter — Find Unused Functions, Variables & Imports

returnofthecoder

|
3 installs
| (0) | Free
Highlights unused code across your entire project. Supports JS/TS, Python, and Go. One extension replaces five.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Dead Code Highlighter

Find every unused function, variable, and import in your entire project.

Your project has dead code. Guaranteed. Functions nobody calls, imports nobody uses, exports nobody imports. Dead Code Highlighter finds all of them — across every file in your project.

One extension, not five

Currently, finding dead code in VS Code requires installing separate extensions for unused imports, unused variables, unused functions, and unused exports. None of them talk to each other. None of them do cross-file analysis. Dead Code Highlighter replaces all of them with a single, unified tool that understands your entire project.

Features

Dead Code Detection

  • Unused imports — named, default, namespace, CommonJS require(), and dynamic import()
  • Unused exports — functions, classes, variables, types, and interfaces exported but never imported by any file
  • Unused locals — functions, variables, classes, interfaces, type aliases, and constants defined but never referenced
  • Multi-language — JavaScript, TypeScript, Python, and Go

Visual Feedback

  • Gutter icons — circle with strikethrough on lines containing dead code
  • Inline decorations — strikethrough on the identifier, "unused" annotation after the line
  • Diagnostics — appears in the Problems panel with actionable messages
  • Tree view panel — "DEAD CODE" section in the Explorer sidebar showing all dead code organized by file
  • Status bar — shows total count at the bottom of the window

Quick Fix Actions

  • Remove unused import — deletes the import statement (or just the unused specifier from a multi-import)
  • Remove all unused imports in this file — batch removal
  • Remove export keyword — keeps the declaration, removes the export
  • Delete declaration — removes the entire function/variable/class
  • Prefix with _ — marks as intentionally unused without deleting
  • Ignore symbol — adds to ignore list so it's never flagged again

Smart Analysis

  • Cross-file export analysis — builds a project-wide import graph to detect exports no file imports
  • Binding-aware reference detection — uses TypeScript's own LanguageService.findReferences() for accurate scope-resolved references
  • tsconfig path alias support — resolves @/utils, ~/components, and custom path mappings
  • TypeScript ESM support — resolves .js imports to .ts source files
  • CommonJS support — detects require() and destructured require
  • Re-export tracking — export * from and export { x } from create proper import graph edges
  • Entry point exclusion — index.ts, test files, config files are excluded from unused export checks
  • Incremental updates — re-analyzes only changed files on save (<100ms)

How It Works

Dead Code Highlighter builds a reference graph of your entire project. For every symbol defined in every file, it checks whether that symbol is used anywhere. If it's not, it's dead.

  1. Phase 1 — Parses every file into an AST and extracts all symbol definitions and references
  2. Phase 2 — Compares definitions against references within each file to find unused imports and locals
  3. Phase 3 — Builds a project-wide import graph and checks whether each export is imported by any other file

Safety

This extension will never tell you to delete code that is actually used.

The detection uses TypeScript's own binding resolution (findReferences()), the same engine that powers VS Code's "Find All References" feature. When the binding resolver is unavailable, it falls back to name-matching, which is conservatively wrong — it over-counts references, meaning it might miss some dead code but will never falsely flag live code.

Before deleting anything:

  • Read the diagnostic message — it tells you exactly why the code is flagged
  • Use "Prefix with _" instead of "Delete" if you're unsure — it marks the code as intentionally kept
  • Every Quick Fix edit goes through VS Code's normal undo stack — Ctrl+Z reverses any removal instantly
  • The tree view panel gives you a full overview before you start deleting

Tested against real projects:

  • Redux, TypeORM, Zod, got, react-hook-form, drizzle-orm
  • 1,658 source files scanned, zero false positives
  • 1,795 automated tests including adversarial, fuzz, and property-based testing

Performance

  • Scans 1,000 files in under 10 seconds
  • Incremental updates in <100ms when you save a file
  • Zero impact on VS Code startup — analysis runs in the background

Configuration

Setting Default Description
deadCode.languages ["javascript", "typescript", "python", "go"] Languages to scan
deadCode.excludePatterns ["**/node_modules/**", "**/dist/**", ...] Glob patterns to exclude
deadCode.entryPoints ["**/index.{ts,js}", "**/*.test.*", ...] Files whose exports are never flagged
deadCode.ignorePatterns ["_*"] Symbol name patterns to ignore
deadCode.scanOnSave true Re-scan on file save
deadCode.scanOnOpen true Analyze files when opened
deadCode.showGutterIcons true Show gutter icons
deadCode.showInlineDecorations true Show strikethrough and annotations
deadCode.maxFilesToScan 10000 Maximum files to scan
deadCode.autoRemoveUnusedImports false Auto-remove unused imports on save (Premium)

FAQ

Will it flag code that's used by tests? No. Test files are included in the analysis. Exports used only by tests are not flagged.

Will it flag React component exports? Entry point files (index.ts, app.ts) are excluded by default. Configure additional entry points in settings.

Does it slow down my editor? No. The initial scan runs in the background and incremental updates take <100ms.

What if it flags something I want to keep? Right-click the symbol in the Dead Code panel and select "Ignore." Or prefix the name with _ using the Quick Fix. Or add it to deadCode.ignorePatterns in settings.

Can I undo a deletion? Yes. Every Quick Fix goes through VS Code's normal edit system. Ctrl+Z (or Cmd+Z) undoes it instantly.

Premium Features ($5 one-time)

Unlock with a one-time $5 purchase. No subscription, no recurring charges.

  • Auto-remove unused imports on save — like Prettier for dead code
  • Export dead code report — comprehensive Markdown document
  • Interactive cleanup mode — guided Delete/Keep/Skip walkthrough
  • CI integration — generate GitHub Actions, GitLab CI, or Azure DevOps configs
  • Team dashboard — dead code trends and per-contributor breakdown
  • Baseline comparison — only flag new dead code in pull requests

Purchase Premium

Known Limitations

  • Python/Go — uses tree-sitter for parsing, which handles most patterns but may miss some language-specific idioms
  • Dynamic access patterns — eval(), window[name](), Reflect.getMetadata() cannot be detected statically
  • Bundler-specific aliases — Webpack/Vite aliases not in tsconfig are not resolved (add affected files to entryPoints)
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft