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 nose.tools import set_trace\s*set_trace\(\)$|\s*import pdb;?\s*pdb.set_trace\(\)$/, 'gmi'); | |
editor.backwardsScanInBufferRange(regex, range, (iterator) => { | |
iterator.replace(''); | |
}); | |
editor.groupChangesSinceCheckpoint(checkpoint); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment