[SOLVED] Looking for an Atom Package to Comment Out console.log in all files?


I use console.log for all kinds of reasons during development, but mostly for checking that certain events and such are occurring when i think they should in my code.

Cleaning that up manually however, becomes a more daunting task with each line I write. Is there a package that will comment out my console.log lines in javascript?

I found one that removes all console.log lines, but I don’t want to remove them as they can still be useful in debugging at times.



Try this ->

NOTE: “Have project open” means the project folder is available in the tree-view of Atom.
FILE > Open Folder can help with that.

To keep the indentation and ignore lines that are already commented out ->
SEARCH. . . . ^([ \t]*)(console[.]log)
REPLACE. . . $1// $2

Note… this will only work if console.log()
is at the start of the line (ignoring white-spaces).
Please confirm working before deploying everywhere.


Great answer, and yep about a half hour after I posted the question it dawned on me to just use Find and Replace all, and that worked perfectly. Thanks.