Skip to content

Instantly share code, notes, and snippets.

@steveoh steveoh/init.js

Created Jan 31, 2017
Embed
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 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
You can’t perform that action at this time.