Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Safe Console.log RemoverNew to Visual Studio Code? Get it now.
Safe Console.log Remover

Safe Console.log Remover

Aman Nasir

| (0) | Free
Right-click a folder to remove every console.log call inside it, safely, using a real parser.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Safe Console.log Remover

Right-click a folder in the Explorer and choose Remove console.log. Every console.log(...) call in the folder's JS/TS files is removed, after a confirmation that shows how many calls and files are affected.

How it decides what to remove

Each file is parsed (with @babel/parser, so TS, TSX and JSX all work). A call is only removed when it is a statement on its own, inside a block, the file body or a switch case:

console.log(a)            // removed, including its line
if (x) { console.log(a) } // removed

Calls used as a value are left in place, because deleting them would break the code. They are listed in the Output → Remove console.log panel:

items.forEach(i => console.log(i)) // kept
if (x) console.log(a)              // kept (no braces)
debug && console.log(a)            // kept

Files that fail to parse are never touched.

Changes are applied as unsaved edits: review them, then Save All (or undo).

Settings

Setting Default
removeConsoleLog.methods ["log"] Which console methods to remove, e.g. ["log", "debug", "info"]
removeConsoleLog.exclude node_modules, build, dist, out, .git Glob of paths to skip

Development

npm install
npm test        # unit tests for the parsing logic (test/run.js)

Press F5 to open an Extension Development Host with the sample/ folder.

To build an installable file: npm install -g @vscode/vsce, then npm run package, then Extensions → … → Install from VSIX.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft