Skip to content

Instantly share code, notes, and snippets.



Created Jan 31, 2017
What would you like to do?
an atom command to remove common python debug statements. open your atom config folder. possibly rename init.cson to init.js and place this your file.
atom.commands.add('atom-text-editor', 'custom:remove-debug', () => {
const editor = atom.workspace.getActiveTextEditor();
const range = editor.getBuffer().getRange();
const checkpoint = editor.createCheckpoint();
const regex = new RegExp(/\s*from import set_trace\s*set_trace\(\)$|\s*import pdb;?\s*pdb.set_trace\(\)$/, 'gmi');
editor.backwardsScanInBufferRange(regex, range, (iterator) => {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment