Remove unused imports across every language — VS Code language tooling first, with built-in fallbacks for JS/TS, Python, Go, Java, Kotlin, Rust, Dart, PHP, C#, Swift, and more.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Import Wipe removes unused imports across every programming language. It uses VS Code language tooling first, then falls back to built-in language-specific engines with conservative safety guards.
Supported Languages
Import Wipe works with any language that has a VS Code language server providing code actions. When a language server is unavailable, built-in fallback engines handle the following languages directly:
Language
Fallback Engine
JavaScript / JSX
ts-morph AST analysis
TypeScript / TSX
ts-morph AST analysis
Python
Lexical analysis (import / from ... import)
Go
Lexical analysis (single & block imports)
Java
Lexical analysis
Kotlin
Lexical analysis
Scala
Lexical analysis
Rust
Lexical analysis (use statements, brace groups)
Dart
Lexical analysis (as, show imports)
PHP
Lexical analysis (use statements)
C#
Lexical analysis (using statements)
Swift
Lexical analysis
C / C++
Lexical analysis (#include, best-effort)
Ruby
Lexical analysis (require / require_relative)
Elixir
Lexical analysis (alias / import)
Haskell
Lexical analysis (qualified & specific imports)
Features
Remove unused imports from the current file via right-click context menu or Command Palette
Remove unused imports in the entire project with cancellable progress and parallel batching
Undo last project wipe to restore all files changed by the last project-wide wipe
Auto-clean on save via importwipe.cleanOnSave
Safer project-wide execution: skips dirty files and very large files (> 2 MB) to avoid risky overwrites
Multi-tier engine for maximum reliability:
Language server code actions (removeUnusedImports, organizeImports)
Language-specific AST/lexical fallback when code actions are unavailable
Conservative fallback gate: for non-JS/TS languages, if language tooling returns import actions but chooses no changes, lexical fallback is skipped
Deterministic JS/TS cleanup: if TypeScript/JavaScript code actions no-op, Import Wipe still runs ts-morph fallback
Fast precheck path: files without import-like syntax are skipped early
Lazy-loaded internals — ts-morph is only loaded when actually needed
esbuild-bundled for fast activation and small install size
Usage
Open a source file.
Right-click in the editor and run:
Import Wipe: Remove Unused Imports (current file)
Import Wipe: Remove Unused Imports in Entire Project
Or use Command Palette (Ctrl+Shift+P / Cmd+Shift+P) to run any Import Wipe command.
To undo a project-wide wipe, run Import Wipe: Undo Last Project Wipe.
Commands
Command
Description
Import Wipe: Remove Unused Imports
Clean unused imports in the current file
Import Wipe: Remove Unused Imports in Entire Project
Clean unused imports across the workspace
Import Wipe: Undo Last Project Wipe
Restore all files changed by the last project wipe
Extension Settings
Setting
Default
Description
importwipe.cleanOnSave
false
Automatically remove unused imports each time a file is saved.
How It Works
Import Wipe uses a cascading strategy to maximize accuracy and language coverage:
Code Actions: asks the active language server to remove unused imports. This is the most accurate approach and works with any language that has proper VS Code extension support (for example, Pylance for Python, gopls for Go, rust-analyzer for Rust).
Language-specific fallback: if code actions are unavailable or ineffective, Import Wipe uses built-in engines tailored to each language. For JS/TS this uses full AST analysis via ts-morph. For Python, Go, Java, Rust, and others, it uses lexical analysis that strips strings and comments before scanning identifier usage.
Safety gate: for non-JS/TS languages, if code actions are available and return import-cleanup candidates but make no changes, fallback removal is not forced.
JS/TS reliability guard: when code actions do not modify a JavaScript/TypeScript file, Import Wipe runs ts-morph fallback to ensure unused imports are still removed.
Star/wildcard imports (for example, from x import *, import java.util.*) are preserved and never removed.