Skip to content

Instantly share code, notes, and snippets.

@ArtemGovorov
Last active August 29, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ArtemGovorov/8dce6ec67959b6ce97a5 to your computer and use it in GitHub Desktop.
Save ArtemGovorov/8dce6ec67959b6ce97a5 to your computer and use it in GitHub Desktop.
Atom markers for non empty lines
'use babel';
class Test {
activate(state) {
let self = this;
atom.commands.add('atom-workspace', {
'atom-markers-performance:toggle': () => {
// just creating markers for all non-empty lines of the the active document
let editor = atom.workspace.getActiveTextEditor();
let lines = editor.getText().split('\n');
let markers = [];
for (let lineNum = 0, lineCount = lines.length; lineNum < lineCount; lineNum++) {
if (lines[lineNum].length) {
markers.push(editor.markBufferPosition([lineNum, 0], {
persistent: false,
maintainHistory: false
}));
}
}
console.log('Created ' + markers.length + ' markers, now try editing the sample.');
}
});
}
}
export default new Test();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment