parinfer

cfleming 2020-09-22T22:06:14.008500Z

@mauricio.szabo I’m interested by this, what does parinfer-plus do for pasting?

mauricio.szabo 2020-09-22T22:08:29.010200Z

@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)

cfleming 2020-09-22T22:09:00.010700Z

Ah, ok, so it will essentially indent the code after pasting?

mauricio.szabo 2020-09-22T22:17:13.012200Z

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

cfleming 2020-09-22T22:18:48.013Z

Right. In Cursive, I’ve also considered various options to ensure that pasted text is balanced etc before inserting it.