xeus-cling
xeus-cling copied to clipboard
Code reformating
For our students (and for us trying to understand their program!), it would be super helpful to have a simple code reformater. At least that would do reindentation.
This is probably more an issue for the cell editor (Code::Mirror) rather than xeus-cling. Alas the former does not seem to currently support code reformating anymore, nor in the foreseable future: http://codemirror.977696.n3.nabble.com/codemirror-3-0-format-preloaded-textarea-code-td4026907.html
I created this issue to keep track of how many xeus-cling users would be interested by the feature, and if sufficiently many see if we could do something about it.
To be honest I don't know how the internals of xeus/xeus-cling work but if you can get the contents of the cell somewhere, and put them through clang-format
and then send them back to the frontend, it should be reasonably simple to program (just need to figure out if invoking clang-format is save (which it probably isn't).
I think that it is more related to the notebook than xeus-cling
. Maybe @carreau knows the latest about how to do this.
Reformating within a live notebook might not be the easiest. There is in general a question on how to get plugin for change the text in cell. It's not something we have right now but it should be possible to be hacked together. It's probably a question on hacking on that for about a day or so and finding the time. Do you have any command line formatter that you'd like to run on the cell specifically ?
On Oct 24, 2017 13:12, "Sylvain Corlay" [email protected] wrote:
I think that it is more related to the notebook than xeus-cling. Maybe @Carreau https://github.com/carreau knows the latest about how to do this.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/QuantStack/xeus-cling/issues/69#issuecomment-339116571, or mute the thread https://github.com/notifications/unsubscribe-auth/AAUez1foPsHDX5DDudYmwRWm7SWqVlmWks5svkTGgaJpZM4QEQDy .
@Carreau the de-facto standard for c++ formatting is clang-format
Is there a plugin to format c++ in notebook now?