Last active
August 29, 2015 14:26
-
-
Save ArtemGovorov/8dce6ec67959b6ce97a5 to your computer and use it in GitHub Desktop.
Atom markers for non empty lines
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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