Customize ATOM to comment React JSX blocks
I'll admit this isn't the most polished... But here's a command I added to Atom for commenting out blocks in React JSX files:
init.coffee:
atom.workspaceView.command 'my:comment-jsx', ->
editor= atom.workspaceView.getActiveView().getEditor()
return unless editor.selections.length and editor.cursors.length
cursor= editor.cursors[0]
return unless 'source.js.jsx' in cursor.getScopes()
text= editor.selections[0].getText()
editor.insertText( "{/*#{ text }*/}" )
And for a helpful shortcut:
keymap.cson:
'.editor':
'alt-cmd-/': 'my:comment-jsx'
Written by Matt McCray
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#