repl icon indicating copy to clipboard operation
repl copied to clipboard

REPL - (CMD | CTRL) + / for commenting code out

Open JasonSooter opened this issue 7 years ago • 4 comments

I often find myself wanting to comment code out in the REPL. I think this is a standard keyboard shortcut for commenting code as it works is every REPL I can think of. I'd be glad to dig into it if it something that would be approved.

JasonSooter avatar May 23 '18 13:05 JasonSooter

I think it would be very nice to have. I don't know if that is the standard, but it's certainly a version I've seen before. If you feel like digging into it, by all means, please do.

CrossEye avatar May 23 '18 15:05 CrossEye

@CrossEye Well, I have been unable to get it figured out. Here's what I know:

The functionality related to commenting with CodeMirror is accomplished with the comment addon.

Adding this line import 'codemirror/addon/comment/comment'; to the REPL repository CodeMirror config file, lib/js/codemirror/codemirror.js, includes the addon.

The (CMD | CTRL) + / shortcut key for commenting appears to get turned on when giving the CodeMirror config object keyMap: 'sublime'. Adding import 'codemirror/keymap/sublime'; to the config file enables the keymap.

But I have been unable to get the commenting functionality to happen. My assumption is that it is getting blocked or ignored by the part of the REPL that is processing the code being typed and I can't seem to figure out where that is. I looked over the graphql/graphiql REPL repository which has a similar CodeMirror setup as the Ramda REPL. It has the commenting feature enabled in what I'd consider a convenient way (line and block).

I can submit the PR with the above code changes for now. And I'd be happy to keep working on it but I am at a wall with it. Maybe some insight from you or someone else might help. Thanks!

JasonSooter avatar May 24 '18 17:05 JasonSooter

I don't have much experience with the REPL code, so I probably won't be much help, but if you post a partial PR, someone who does know might be able to chip in.

Please make it clear in the PR that the code is not ready for merging.

Thanks! Sorry you hit a wall here.

CrossEye avatar May 24 '18 21:05 CrossEye

@CrossEye Ok. Partial PR made. See PR. I hope you are right in that someone comes along to chip in. Thanks!

JasonSooter avatar May 25 '18 21:05 JasonSooter