Detects unused variables, imports, and functions in your project — and removes them only after you give permission. Works across multiple languages by reading the diagnostics that VS Code's built-in language servers and popular linters (TypeScript, ESLint, Pylint/Pyflakes, Java, C#, Go) already produce.
Features
- Inline Quick Fix — click the lightbulb 💡 on any "unused" warning to remove just that line.
- Scan This File — right-click in the editor or open the Command Palette
and run
Unwanted Code Remover: Scan This File. You'll see a summary popup listing what was found, with options:- Remove All — deletes everything in one go
- Review One by One — confirms each removal individually
- Scan Entire Workspace — run
Unwanted Code Remover: Scan Entire Workspaceto find and clean unused code across every JS/TS/Python/Java/C#/Go file in the project (excludingnode_modules). - Nothing is ever removed without a confirmation popup.
How detection works
This extension does not reimplement a parser for every language. Instead it reads diagnostics already reported by:
- TypeScript/JavaScript's built-in language service
- ESLint (
no-unused-varsrule) - Pylint / Pyflakes (
F401unused import,F841unused variable) for Python - Java/C#/Go language servers, if installed
➡️ Make sure the relevant linter/language server is installed and active for a given language, otherwise this extension won't detect anything for that file (it has nothing to read).
Known limitation
Removal works by deleting the entire line containing the unused declaration. This is reliable for the common case (one import/variable/ function per line) but will not gracefully handle multiple declarations packed on a single line — review the diff before saving if your code style does that.
Try it locally before publishing
npm install -g @vscode/vsce
cd unwanted-code-remover
vsce package
Then in VS Code: Extensions → ... menu → Install from VSIX → select the
generated .vsix file.
Publish to the Marketplace
vsce publish
(Requires a free publisher account — see Marketplace publisher management page.)