Fork me on GitHub
#parinfer
<
2016-03-16
>
cfleming00:03:16

Then it gets a “file was updated on disk” event, which I can catch but I can’t modify the document during.

cfleming00:03:47

Then after that I get some document updates, which I debounce and run parinfer after 10ms.

cfleming00:03:23

Unfortunately there’s no way I can think of to reliably run paren mode between the updates, since I don’t have the intermediate document states when I finally come to run indent mode after debouncing.

cfleming00:03:00

i.e. if there’s a file reload event I can mark that file as needing paren mode, but if there are more updates before I actually run paren mode then the document is modified in place and I can’t get the previous version. Even if I could, if paren mode modifies it then the later updates may be invalid since the document will have changed.

snoe00:03:44

Ugh I'm glad I didn't go far down the road of trying to write a neovim backed intellij editor plugin.

cfleming01:03:47

@snoe: Yeah, I’ve actually considered that myself but I suspect it would be difficult.

cfleming01:03:16

All the complexity means that massive codebases work really well, but this sort of integration is not easy. This is one of the most difficult things I’ve had to shoehorn into IntelliJ, which I didn’t expect.

shaunlebron03:03:22

what a nightmare

shaunlebron03:03:56

I’m not sure there is a precedent for the type of transformation that parinfer performs

shaunlebron03:03:22

and I think that is why editor integration has been difficult

shaunlebron03:03:09

editors do not anticipate plugins to act as a kind of middleware like this

cfleming03:03:33

@shaunlebron: I’d agree with that - I can’t think of any other transformation that works like this, except something like file formatting.

cfleming03:03:43

And that’s generally integrated pretty deeply into the editor.

cfleming03:03:31

Certainly IntelliJ isn’t really designed for it, but it’s not really designed for text-based manipulation based on events in general.

cfleming03:03:09

Anyway, my workaround now works, the only corner case is if the user manages to create a manual event within 10ms of the file being opened, that event will get paren mode instead of indent mode. It seems very unlikely that this could happen based on user input, but some kind of plugin modifying the doc based on some event might happen.

chrisoakman04:03:59

@cfleming: thank you for staying on top of parinfer-jvm and pushing that update with previewCursorScope

chrisoakman04:03:41

@jasongilman: not yet; still need to give it a think. have been focusing elsewhere the last week or so

cfleming08:03:33

@chrisoakman: No worries, I’ll have to push a point release, I realised that there are some === that sneaked in there from cut’n’pasted code.

cfleming08:03:52

All the tests pass, it may not actually be a problem, but I’ll fix that in the next couple of days.

cfleming08:03:18

It’s pretty impressive that copying JS actually produces almost valid Kotlin.

dominicm10:03:57

That's mildly hilarious.

jasongilman12:03:43

Thanks @chrisoakman. Parinfer in Atom is great. I never hear anyone mention Atom and Clojure without also saying "And of course you should use Parinfer too"

sekao23:03:40

i released nightcode 1.1.0 with parinfer 😃 i’ll be teaching my java class some clojure next week using it so i’ll let y'all know how it goes

cfleming23:03:32

@sekao: Awesome, I’d love to hear if it’s helpful for them.