Note: The formatting addon receives a fair amount of bug requests. I (the maintainer of CodeMirror) do not intend to spend time on improving it. Pull requests (if clean and intelligent) are welcome, but you should see this code as a proof-of-concept (using CodeMirror's mode tokenizers to help format code), not a finished, robust module.
Select a piece of code and click one of the links below to apply automatic formatting to the selected text or comment/uncomment the selected text. Note that the formatting behavior depends on the current block's mode.
Autoformat Selected | Comment Selected | Uncomment Selected |