Fork me on GitHub
#parinfer
<
2020-09-22
>
cfleming22:09:14

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

mauricio.szabo22:09:29

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

cfleming22:09:00

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

mauricio.szabo22:09:13

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

cfleming22:09:48

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