When reviewing, I often find myself copying the source to open in an IDE locally. Maybe we could add a button to download the source snippets to help facilitate this?

## marked as duplicate by Vogel612♦, Community♦Aug 24 '16 at 18:13

• To copy from a website to your editor? Or just to copy the code block? – Peilonrayz Aug 24 '16 at 17:43
• @JoeWallis To download the snippet to a file with the correct extension. – rookie Aug 24 '16 at 17:46
• There have been regulars doing something like this already. If you give me a minute I'll make it an answer. – Mast Aug 24 '16 at 17:47
• Possibly related: codereview.stackexchange.com/a/41210/31562 . I think the best bet would be to make a userscript for it, possibly one that provides a link or makes a request to some webservice that fetches the post and provides a downloadable file. I don't really expect Stack Exchange to provide a feature for this. – Simon Forsberg Aug 24 '16 at 17:47
• The question got closed before I could finish my answer, see the answer on the linked question instead. As far as the request itself goes, I don't give it much chance. Sure, it would be great. But it would have to support quite some languages and we review the weirdest things here. It would be quite a heavy feature relevant for only one site. – Mast Aug 25 '16 at 10:46

javascript: $('pre.prettyprint').not('button + *').each( function() { /* Thank you http://stackoverflow.com/a/2838358/7602 */ function selectCode(el, win) { win = win || window; var doc = win.document, sel, range; if (win.getSelection && doc.createRange) { sel = win.getSelection(); range = doc.createRange(); range.selectNodeContents(el); sel.removeAllRanges(); sel.addRange(range); } else if (doc.body.createTextRange) { range = doc.body.createTextRange(); range.moveToElementText(el); range.select(); } } var buttonText = 'Select Code', length = buttonText.length, codeBlock = this,$link       = $('<button type=\'button\'>' + buttonText + '</button>').click(function() { console.log($(codeBlock).text().substring( length ) );          selectCode(codeBlock);        });    $(codeBlock).before($link );  });void(0);