@mauricio.szabo I’m interested by this, what does parinfer-plus do for pasting?
@cfleming well, the current implementation is quite a hack 😄. But it's here: https://github.com/mauricioszabo/atom-parinfer-plus/blob/master/src/parinfer_plus/core.cljs#L32-L33
Basically, it tries to detect if the new text contains at least two \n
, and if it's a valid/balanced code. If it does, it'll parse then use parenMode
to indent things (ignoring the current user selection, be it indent or smart mode)
Ah, ok, so it will essentially indent the code after pasting?
Yes - but that's what parinfer does after any user edit (indents or changes the code). The only difference with this "paste hack" is that instead of using the user's preferred mode, it always uses parenMode
Right. In Cursive, I’ve also considered various options to ensure that pasted text is balanced etc before inserting it.